Cropping out two images from one big image by manually selecting the cropping are

Illustration
Jasmin - 2020-10-26T09:56:45+00:00
Question: Cropping out two images from one big image by manually selecting the cropping are

How can I crop two images out from one big image by manually selecting the region for cropping out with a rectangle for example? Additionally, how can I extract the rows and columns that I selected with the rectangle?

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

img = imread('pears.webp');

figure();
ax1 = axes();
imshow(img, 'Parent', ax1)
fprintf('Drag a rectange on the image.\n')
roi = drawrectangle(ax1);

img_small = imcrop(img, roi.Position);
figure();
ax2 = axes();
imshow(img_small, 'Parent', ax2)


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!