MATLAB: Hi all, i want to get the cropped image in another axes with the same size of the crop rectangle??Is there any way….

digital image processing

Hi all i am stuck with my code.I want my cropped image in an axes which is having the same size as that of the crop rectangle.Thanks in advance…..

Best Answer

Here it is.
%open image and crop it
I = imread('peppers.png');
rect = [70,10,100,200];
Icrop = imcrop(I,rect);
%display results
figure;
subplot(1,2,1);
image(I); axis image;
subplot(1,2,2);
image(Icrop); axis image;