Read, process and write image dataset
이전 댓글 표시
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
Rik
2021년 7월 30일
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
2021년 7월 30일
Rik
2021년 7월 30일
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
2021년 7월 30일
Rik
2021년 7월 30일
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.
채택된 답변
추가 답변 (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
카테고리
도움말 센터 및 File Exchange에서 Display Image에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
