Read, process and write image dataset
Mostrar comentarios más antiguos
Hello, I have image dataset containing 5000 images. I enhanced the one image from this dataset in the matlab my code is working good and i got good result. Now i need help in processing this all 5000 images using my filter code and have to store that processed images in my laptop local folder. How to read, process and write 5000 images in one go. can anybody know how to do that?
5 comentarios
Rik
el 30 de Jul. de 2021
You don't do it in one go: you use a loop.
doc dir
doc for
doc parfor %if you have the parallel computing toolbox
Aravind Prabhu Gopala Krishnan
el 30 de Jul. de 2021
Rik
el 30 de Jul. de 2021
What is your question exactly? You have a pipeline that works for 1 image, so what is exactly the problem in getting it to work for a list of files?
Aravind Prabhu Gopala Krishnan
el 30 de Jul. de 2021
Rik
el 30 de Jul. de 2021
What is your question? Weren't you already writing the result to local storage? How does your current pipeline look? It should start with a way to load an image, and it should end with writing that image to some storage. How are you doing that last step?
Bro.
Respuesta aceptada
Más respuestas (1)
Updated version of code with example implementation
infolder = ''; %path to input folder
outfolder = ''; %path to output folder
if ~exist(outfolder, 'dir')
mkdir(outfolder);
end
%replace image extension as required
imgFiles = dir(fullfile(infolder, '*.tiff'));
N = length(imgFiles);
for i = 1:N
thisFile = fullfile(infolder, imgFiles(i).name);
[~, name, ext] = fileparts(thisFile);
outFile = fullfile(outfolder, [name ext]);
%To read the file
I = imread(thisFile);
%Do your operation below
if isa(I,'uint16')
I = im2double(I);
I = imnoise(I,'salt & pepper',0.02);
I = im2uint16(I);
else
I = imnoise(I,'salt & pepper',0.02);
end
%------------------------
%Writes the file to folder
imwrite(I, outFile);
end
Categorías
Más información sobre Data Import and Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
