imref2d axis direction

23 次查看(过去 30 天)
Matthias
Matthias 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 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by