Changing file save name
4 ビュー (過去 30 日間)
古いコメントを表示
I have 10 images (collages), within each image there is anywhere from 20-200 smaller images. In total there are 3000 images between all 10 images.
Currently my code crops the small images from the collages and I know have 3000 images. When I save each of the small cropped image is saves it like... NAME%collage1%001, NAME%collage1%002,...,NAME%collage10%200.
I would like to save each of the small cropped images as... NAME%001, NAME%002,..., NAME%3000.
sum_blob = sum(numberOfBlobs) % I use this to get the sum of the number of blobs on each of the 10 collage images
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')
for n = 1 : non_binary_images
for k = 1 : numberOfBlobs(n) % Loop through all blobs.
% Find the bounding box of each blob.
thisBlobsBoundingBox = blobMeasurements{n}(k).BoundingBox; % Get list of pixels in current blob.
% Extract out this zoop into it's own image.
subImage = imcrop(OG_images{n}, thisBlobsBoundingBox);
% Saving the cropped image
folder = 'folder';
thisBaseFileName = sprintf('NAME%4d_%03d%.tif', n, k);
thisFullFileName = fullfile(folder, thisBaseFileName);
imwrite(subImage, thisFullFileName,'tif');
end
end
end
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!