How to crop an image and automatically crop another image with same positioning?

i have a GUI like this
how to crop an image from axes, when i click the "crop" button and automatically crop with same position in another image when i click "crop2" button, thanks before,

답변 (2개)

One of the outputs from imcrop is the bounding rectangle. Here's a quick example:
I = imread('cameraman.tif');
II = imread('peppers.png');
II = imresize(II,size(I)); % same size
[Icrop,rect] = imcrop(I);
IIcrop = imcrop(II,rect);
subplot(1,2,1)
imshow(Icrop)
subplot(1,2,2)
imshow(IIcrop)
Chad Greene
Chad Greene 2014년 12월 22일
편집: Chad Greene 2014년 12월 22일
Those look like Landsat 8 images. With geoimread, you can specify a bounding box of lat/lons or map x/y coordinates and only load pixels corresponding to that bounding box.
Using geoimread, the user could click a "select region" button which you could program to call inputm. When the user's done entering points, she could click "crop" and coordinates from inputm could then be entered into geoimread.

댓글 수: 4

thanks Chad, but when i want to crop the another image, how i can know the position?so that both image has a same position/cordinates? can you help me? thanks
When the user clicks a bounding box in image A (calling inputm), use those coordinates to load only that region in images A and B with geoimread.
sorry chad, i dont completely understand what you mean, can you explain with simple code about that, thanks for helping
Hello Mike How did you solve this? I have the same problem, and when I get the second image cropped, there is a lillte spatial difference between both images. I will appreciate if you could help me.

댓글을 달려면 로그인하십시오.

질문:

2014년 12월 20일

댓글:

2017년 12월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by