How to convert coordinate system of java image to conventional coordinate system?

1.4k Views Asked by At

I am working on some image processing problem. So I am facing a problem that in java the coordinate system of image is not like the conventional coordinate system used in Mathematics (where origin is at bottom left corner), but instead it is a coordinate system where the origin is at top left corner and x increases to the right side, and y increased downside.

I want to change it to the conventional coordinate system. Please help me how to do that?

2

There are 2 best solutions below

0
On

Make the following transformation:

y2 = image.height - y

x2 = x

0
On

that's easy! let your max ordinate be 'Ymax'(for e.g. its 480 for 640x480) then new ordinate

Ynew = Ymax - Y (where Y is the ordinate u want to display)