So I am new to matlab and having trouble using the imwrite() function. I uncollaged an image (137 seperate images) and want to save the individual images to a new folder. How do I use the imwrite() function to save all the cropped images? I was using this post … https://www.mathworks.com/matlabcentral/answers/73719-uncollage-a-collage-image
Code…
message = sprintf('Would you like to crop out and save each individual images?');reply = questdlg(message, 'Extract Individual Images?', 'Yes', 'No', 'Yes');% Note: reply will = '' for Upper right X, 'Yes' for Yes, and 'No' for No.
if strcmpi(reply, 'Yes') figure; % Create a new figure window.
% Maximize the figure window.
set(gcf, 'Units','Normalized','OuterPosition',[0 0 1 1]); for k = 1 : numberOfBlobs % Loop through all blobs.
% Find the bounding box of each blob.
thisBlobsBoundingBox = blobMeasurements(k).BoundingBox; % Get list of pixels in current blob.
% Extract out this zoop into it's own image.
subImage = imcrop(originalImage, thisBlobsBoundingBox); % Saving the cropped image
**imwrite(subImage,'path to folder') ?? ** endend
Best Answer