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

New Shopify Flow Feature: Interact With Customer & Order Properties — EnquireLabsShopify recently…

MapReduce Demo using Java

9 Programming Principles Every Software Developer Should Know

Rabbit Hole of Web Development

GuPM to manage your Node/JS project

Building Covid-19 Dashboard with React.js and Node.js

A website with Strapi 3— Next.js — Google Cloud Run

React can get with this. react can’t get with that.

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

Install TensorFlow with GPU Acceleration Simultaneously for Windows and WSL Linux (1)

No of Pipeline Stages in Verilog coming from an m file (or latency)

Ugly or Nice? Classifying Christmas Sweaters with Computer Vision

Fix Attribute Error and Runtime Error in tensorflow and keras | Beginner Must Read