center crop image based on other image dimension
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have two images of the same area but with different size: an RGB and TIR format.
I'm drawing a polygon on one of them and convert it to a mask in order to get the same cropped area in the second image.
in QGIS it works: (this is the TIR on top of the RGB)
When I try to do it in MATLAB it fails.
The polygon-
To use the mask in the RGB image I resized the image in the center:
targetSize = size(TIR);
r = centerCropWindow2d(size(RGB),targetSize);
RGB = imcrop(RGB,r);
Now when I try to use the same mask on the RGB image, I get a different area (much closer):
I've also tried to do it the other way, to padd the small image with zeros around it accordingly.
Is it even possible? I want to get the same output as in the QGIS.
Any help is highly appreciated!
댓글 수: 4
DGM
2022년 5월 4일
I am really not familiar with mapping toolbox stuff at all, but maybe someone else is. I might be able to bang my head against it for a bit, but I'd really have to have the actual files to be able to have any confidence that I'm actually replicating the issue correctly.
Is trim_tif() a user-defined function?
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!