# How to translate image points position(row, column) to their coordinate(x,y)?

Here is the code to find image edge and record the morphological connected pixels positions. How to translate the row/col positions to x/y coordinates?

i = ExampleData[{"TestImage", "Lena"}];
im = EdgeDetect[i, 5];
imm = MorphologicalComponents[im];
a = Position[imm,200];


"a" gives a list of positions, how to translate them to x/y coordinates?

The image coordinate x is the second element of the position; the image coordinate y is the first position subtracted from the number of rows plus 1.

rows = First@ImageDimensions[i];
xy1 = AffineTransform[{{{0, 1}, {-1, 0}}, {0, rows + 1}}][a]


Another way is to use PixelValuePositions on the morphological components, converted to an Image:

xy2 = PixelValuePositions[Image[imm], 200]


Check:

xy1 == xy2
(* True *)


(They happen to be in the same order.)