imref2d axis direction

조회 수: 17 (최근 30일)
Matthias
Matthias 2016년 1월 19일
답변: Image Analyst 2016년 1월 19일
Hello,
I'm trying to use imref2d to map an image onto world coordinates.
Be default, imref2d seems to consider the top-left corner of a matrix the origin such that, compared to the standard Cartesian coordinate system, the Y-axis is flipped (larger values of Y are further down). See the example on the support page for imref2d.
I'd like to use imref2d without a flipped Y axis. The bottom-left element in the matrix of pixel values should have the lowest x and y values of all pixels, and the top-right element should have the highest x and y values. I tried flipping the world coordinates passed to imref2d, but it throws and error if the values are non-increasing. I could use flipud() on the image matrix, but that seems to defeat the purpose of using a spatial referencing object. Is there a better way?
Thanks, Matt

답변 (1개)

Image Analyst
Image Analyst 2016년 1월 19일
You could use XData and yData and flip the image just for display only:
grayImage = imread('cameraman.tif');
imshow(flipud(grayImage), 'XData', [0, 3], 'YData', [0, 3]);
set(gca, 'YDir', 'normal');
axis on;
axis image

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by