Read, process and write image dataset
Mostra commenti meno recenti
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 Commenti
Rik
il 30 Lug 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
il 30 Lug 2021
Rik
il 30 Lug 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
il 30 Lug 2021
Rik
il 30 Lug 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.
Risposta accettata
Più risposte (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
Categorie
Scopri di più su Data Import and Analysis in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
