Hey there,
This is apart of a larger code so I've entered a value for total_no_images for ease. I want the user to have an option if the image taken is blurry etc so I've tried to sort it out and researched break/return/continue but not managed to get it quite right. I need the program to take a certain amount of images so don't want it to increment if the first image taken is wrong. Would a switch be better? Any help offered is greatly appreciated!
Thanks!
% Hardware Configuration, set image size
vid = videoinput('winvideo', 1);% Preview video
start(vid);preview(vid);total_no_images=3;for i = 1:total_no_images fprintf('Take image %d of %d. Type Yes when ready. \n', i, total_no_images) decide=input('','s'); if strcmp(decide,'Yes') % Compare two strings
img = getsnapshot(vid); % Capture image
image(img); % Preview image
fprintf('Would you like to retake the image? Yes or No. \n') accept=input('','s'); if strcmp(accept,'Yes') % Compare two strings close; % Close preview image
return % If image unacceptable restart
else filename = ['Image ' num2str(i)]; % Make a file name
imwrite(img, filename, 'bmp'); % Save file as BMP
close; % Close preview image end endend%Delete and close video preview
close(vid); closepreview(vid);delete(vid);
Best Answer