Azzera filtri
Azzera filtri

Problem with batch processing

1 visualizzazione (ultimi 30 giorni)
Chathu
Chathu il 28 Feb 2015
Commentato: Image Analyst il 28 Feb 2015
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.

Risposta accettata

Image Analyst
Image Analyst il 28 Feb 2015
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 Commenti
Chathu
Chathu il 28 Feb 2015
@ 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 il 28 Feb 2015
Try export_fig() instead. See the File Exchange.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by