# Extract x,y coordinates\pixels from image - python

Hi , In case I have the below image , how can I extract the x,y coordinates\pixels ? (in python)

edit retag close merge delete

Sort by » oldest newest most voted

The best idea can be use Hough Circle transformation to get the circle from the images. This function will retrieve to you the coordinates regarding the center of the circles.

The problem is that without any other things those value doesn't have much sense. In the graph they have a sense since there are the axis and the data are related to them. So a better way can be consider the Rectangle of the plot area and get the coordinate relative to it. Using the x and y scale you can get the correct value of every point. If you crop the rectangle (you can do it since you have the axis) inside the plot you'll have a rectangle of dimension X*Y. So X and Y it is the pixels dimension of the graph area that you've cropped. Do this automatically is possible if the images have the same format, otherwise is will be a little bit more tricky (not impossible, but tricky), in particular if the value on the axis changes.

Let's consider the first point (I'll call it P1, is the output of the Hough Circle transofrmation, you'll have P1.x as x coordinate and P1.y) in the plot. In the y axis you have 0-1000 while in x axis you have 0-10. Your graph area is then X*Y as we said. The point value will be the result of the following: P1.x:X=x:10 that is, to be clear P1.x*10/X. The same apply for the y value so: P1.y*1000/Y. Applying to every points you'll get the data back.

more

I would trim the photo first, then extract contours with interpolation etc. Anyways there are multiple ways you can do it even by just thresh and find a column where a pixel is not white for each pixel in a row and then map this for real values. It's simple you can do it.

I found a better solution.
Find circles and then you will have exact values of that fixed points.

@Yiftush can you give me a point?

more

Official site

GitHub

Wiki

Documentation