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개)
Sean de Wolski
2014년 12월 23일
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
2014년 12월 22일
편집: Chad Greene
2014년 12월 22일
0 개 추천
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
mike
2014년 12월 23일
Chad Greene
2014년 12월 24일
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.
mike
2014년 12월 25일
sandra viaña borja
2017년 12월 14일
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.
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!