imref2d axis direction

16 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by