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 Center および File ExchangeNumerical 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