Problem with batch processing

1 次查看(过去 30 天)
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 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by