imref2d axis direction
16 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Image Analyst
on 19 Jan 2016
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
0 Comments
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!