필터 지우기
필터 지우기

Creating new Figures from a batch of processed images and writing the new figures to a new folder.

조회 수: 2 (최근 30일)
The code below reads in a batch of images from a folder 'FlatImages', uses a function to mark white edges on the data, creates a new figure of the original image with the new regions marked. How Would I go about writing the new figures to A new folder called 'SegmentedImages'? I'm not very familiar with the print function??
InputFolder = fullfile(pwd, 'FlatImages');
filePattern = fullfile(InputFolder, '*.bmp');
BmpFiles = dir(filePattern);
OutputFolder = fullfile(pwd, 'SegmentedImages');
for i=1:length(BmpFiles)
fname = BmpFiles(i).name;
FullFileNameInput=fullfile(InputFolder, fname);
A=imread(FullFileNameInput);
[s f]=get_white_edges2(A);
Fname_out=['WE_' fname];
figure, imshow(A); hold on; plot([s f]);
FullFileNameOutput=fullfile(OutputFolder, Fname_out);
print(A, FullFileNameOutput);
end

채택된 답변

Sean
Sean 2015년 2월 22일
Got it working with the code below:
InputFolder = fullfile(pwd, 'FlatImages');
filePattern = fullfile(InputFolder, '*.bmp');
BmpFiles = dir(filePattern);
OutputFolder = fullfile(pwd, 'SegmentedImages');
for i=1:length(BmpFiles)
fname = BmpFiles(i).name;
FullFileNameInput=fullfile(InputFolder, fname);
A=imread(FullFileNameInput);
[s f]=get_white_edges2(A);
Fname_out=['WE_' fname];
%FullFileNameOutput=fullfile(OutputFolder);
figure; imshow(A); hold on; plot([s f]);
FullFileNameOutput=fullfile(OutputFolder, Fname_out);
print(gcf, '-dbmp', FullFileNameOutput);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by