필터 지우기
필터 지우기

Problem with batch processing

조회 수: 1 (최근 30일)
Chathu
Chathu 2015년 2월 28일
댓글: Image Analyst 2015년 2월 28일
I want to get all my images(which located in 1 file) processed. This is the code i used(attached,herewith).
1st problem is once the 1st image is processed,how to make it to jump to the next image for processing.
2nd problem is how to change the name of the saved figure at each cycle(eg:S3-Pic1, S3-Pic2, S3
-Pic3 ..etc). Appreciate your feedback.

채택된 답변

Image Analyst
Image Analyst 2015년 2월 28일
Both of these questions are explained well in the FAQ entry: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
  댓글 수: 2
Chathu
Chathu 2015년 2월 28일
@ Image Analyst-thank you so much for your quick response.Really appreciate it. Everything works out well. Except saving the figure didn't work-pls see one before the last line as follows: hgsave(gcf,'Line detection\S3-Pic(k). How to save figures accordingly?
clc
clear all
myFolder = 'E:\2. Cropped imgs\S3- crops';
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(myFolder, '*.jpg');
jpegFiles = dir(filePattern);
for k = 1:45
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
imshow(imageArray); % Display image.
[x,y]=ginput(4); line(x,y)
hold on
[x,y]=ginput(4); line(x,y)
hold on
[x,y]=ginput(4); line(x,y)
hold on
[x,y]=ginput(4); line(x,y)
hgsave(gcf,'Line detection\S3-Pic(k)')
end
Image Analyst
Image Analyst 2015년 2월 28일
Try export_fig() instead. See the File Exchange.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by