Read, Crop and then Save multiple images
Show older comments
I am really new to Matlab, but I need for a project to crop multiple images with the same rectangle and then save them into a new folder.
(I have 172 images in the folder, first one is called frame10.jpg, last one is frame182.jpg)
Here's my code so far:
for n=10:182
image_{n}=imread(sprintf('frame%s.jpg', num2str(n)));
end
[x rect] = imcrop(image_{10})
for n=11:182
imcrop(image_{n}, rect)
end
When I Run it, it opens up all the figures of the images correctly cropped.
My questions are: how can I tell matlab not to open up all the figures of the cropped images since I do not need to see them?
How do I save all the cropped images in a new folder 'Cropped' inside the current folder? (possibly using imwrite but it's not necessary)
Accepted Answer
More Answers (1)
Ismail Nasri
on 7 Feb 2020
0 votes
</matlabcentral/answers/uploaded_files/270469/Captureblm.PNG> Hiw can i use this script for detecting crop and saving multiples images
1 Comment
Mustafa Yildiz
on 29 Mar 2020
Hello did you find any way for do that ?
Categories
Find more on Blocked Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!