How to load multiple images and processing them?

Hi!!!

i’ve been looking for some info about loading “n” images with a script but i havent find anything…

well my idea was create a function with a for loop that changes the index of the image to load, in that way if the firts image its called “1.jpg” the program will load and process the images ‘till it reaches a variable called “m” that is the total of images in my directory….

well i’ve tried like this a lot of times but i cant find the way to make it work. :( so if anyone can help me i will be realy grateful

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

% Read files file1.txt through file20.txt, mat1.mat through mat20.mat
% and image1.jpg through image20.jpg. Files are in the current directory.
for k = 1:20
matFilename = sprintf('mat%d.mat', k);
matData = load(matFilename);
jpgFilename = strcat('image', num2str(k), '.jpg');
imageData = imread(jpgFilename);
textFilename = ['file' num2str(k) '.txt'];
fid = fopen(textFilename, 'rt');
textData = fread(fid);
fclose(fid);
end

A very slight adaptation gives you:

% Read 1.jpg through m.jpg.  
% Files are in the "yourFolder" directory.
for k = 1:m
jpgFilename = sprintf('%d.jpg', k);
fullFileName = fullfile(yourFolder, jpgFilename);
if exist(fullFileName, 'file')
imageData = imread(fullFileName );
else
warningMessage = sprintf('Warning: image file does not exist:\n%s', fullFileName);
uiwait(warndlg(warningMessage));
end
imshow(imageData);
end

Note how I make it more robust by using exist() to check for the file’s

SEE COMPLETE ANSWER CLICK THE LINK

--

--

--

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

I’m Officially Vim User Now!

A Better Flutter App #7

The perils of product management in b2b services world

list of methods in python-python tutorial

Digital Forensics Challenge 2021 Writeup (308— Find Forged Record)

LDAP ขั้นตอนการติดตั้ง

How I aced Google’s Associate Cloud Engineer Exam in two months

AWS Cloud Resume Website

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

More from Medium

Contrast enhancement techniques in HSV or LAB

Machine Learning: Diving Deeper

Realtime Gender and Age Detection Using Wide Residual Networks(WRN)

Build a quick inference CLI for your machine learning model