how to return a crop image to its original shape?
4 views (last 30 days)
Show older comments
i crop an image with boundingbox and improve it. now i want to Background and size re-establishing. can anyone help ?
0 Comments
Answers (1)
Image Analyst
on 3 Jan 2016
What exactly does that mean? How about this
[rows, columns, numberOfColorChannels] = size(originalImage);
croppedImage = ...........whatever
% Resize to match original
croppedImage = imresize(croppedImage, [rows, columns]);
Or did you want it pasted onto a black background the size of the original image (see attached demo)?
4 Comments
Sarah Elsherif
on 13 Feb 2018
Edited: Image Analyst
on 13 Feb 2018
[rows, columns, numberOfColorChannels] = size(originalImage);
croppedImage = ...........whatever
% Resize to match original
croppedImage = imresize(croppedImage, [rows, columns]);
Thank you so much.. I faced the same problem and it is fixed
Image Analyst
on 13 Feb 2018
This resizes the cropped image to be the same number of rows and columns as the original, in effect magnifying it. It does not put the cropped image "pasted onto a black background the size of the original image" like the original poster wanted and asked for. They are completely different things.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!