Ask Your Question
0

Extract x,y coordinates\pixels from image - python

asked 2019-02-17 03:46:11 -0600

Yiftush gravatar image

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

image description

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-03-05 03:58:37 -0600

HYPEREGO gravatar image

updated 2019-03-05 03:59:09 -0600

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.

edit flag offensive delete link more
0

answered 2019-02-20 09:19:20 -0600

Orelox gravatar image

updated 2019-03-04 13:43:42 -0600

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?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-02-17 03:46:11 -0600

Seen: 5,941 times

Last updated: Mar 05 '19