Question

I am new to Matlab. I have an image (the size is mxnx3) with a few human-selected points on the image. For example:

p1 = [267,79];

p2 = [96,372];

These points are image coordinates with (1,1) at the top left. I'm trying to convert this to Cartesian coordinates with (0,0) on the bottom left. How can I do this? Thanks in advance!

Was it helpful?

Solution 2

If you need to directly translate your co-ordinates in code, you could make a simple anonymous function:

img2cart = @(p) [p(1), img.size(2) - p(2)];
q1 = img2cart(p1);
q2 = img2cart(p2);

OTHER TIPS

If I understand correctly: just use

axis xy

From axis doc:

AXIS XY puts MATLAB into its default "Cartesian" axes mode. The coordinate system origin is at the lower left corner. The x axis is horizontal and is numbered from left to right. The y axis is vertical and is numbered from bottom to top.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top