How do I run all images in a folder through an image processing code?

45 visualizaciones (últimos 30 días)
I have written code to process an image in a certain way. I want to be able to add a bunch of similar images into a folder and possibly create a loop that processes each image through the code. Ideas or hints would be greatly appreciated.

Respuesta aceptada

Image Analyst
Image Analyst el 18 de Mayo de 2018

Más respuestas (2)

Ameer Hamza
Ameer Hamza el 18 de Mayo de 2018
A simple GUI based approach is to use Image batch Processor. Start it using
imageBatchProcessor
You can specify the input dataset containing multiple images. You can specify the function you want to apply and also use parallel processing directly from the app to speed up the processing. It will also give the option to save all the processed file in a folder or the workspace.
For doing it programmatically, refer to this link. The general idea is to loop through all files as shown here
files = dir('*.jpg'); % specigy the extension of your image file
for i = 1:numel(files);
filename = files(i).name;
image = imread(filename);
% apply processing to the loaded image
% save the image to an array or back to the folder using
end

Hargun Kaur
Hargun Kaur el 2 de Mayo de 2023
Movida: Image Analyst el 2 de Mayo de 2023
kindly use Image Batch Processor app, already installed in matlab. Just import data from your folder, define a function, and process it.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by