Changing axis values without changing image size

6 visualizaciones (últimos 30 días)
Krista Kelly
Krista Kelly el 8 de Jun. de 2021
Respondida: Walter Roberson el 8 de Jun. de 2021
Hi,
I'm using MATLAB R2021a.
I'm currently displaying an image using this code:
I = imread('imagename');
figure
imshow(I);
axis on;
and then I'm using this code to plot rectangles onto the image:
rectangle('Position', [x,y,w,h], 'EdgeColor','r');
the code is working fine, however I would like to change the x and y values of the image to be different values, while still keeping the same size image. For reference, the image is 1600x900 pixels, but I would like to have the axis values be in degrees so I can plot the rectangles using their degree values. Any help would be appreciated!

Respuestas (1)

Walter Roberson
Walter Roberson el 8 de Jun. de 2021
For that kind of purpose I recommend switching to use image() or imagesc() instead of imshow(). When you use image() or imagesc() then you can pass x and y data coordinates to position the image at. See the XData and YData properties on the image() documentation.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by