Borrar filtros
Borrar filtros

How to map the points of the graph from the coordinates on the image to the actual coordinates

3 visualizaciones (últimos 30 días)
I am implementing an auto-digitizer to extract (x, y) value pairs of a line graph. I have determined the position of the axes and y-axis on the image by specifying the beginning and the end of each axis on the image. I also found the coordinates of the points on the graph image. Now how can I map those values to real values so that I can plot the graph again with the values I just mapped??
Here is my input image:
I have defined the beginning and the end of the x,y axis (the red points) and know the limit ranges of each axis. I have determined the coordinates on the image of the points of the graph (for example, with the blue point in the image, I have determined the coordinates of its x_coord and its y_coord ). Now I want to convert from the coordinates on the image to the actual coordinates so that I can plot the graph again. What formula can help me do that?

Respuesta aceptada

Image Analyst
Image Analyst el 15 de Nov. de 2021
You can get formulas from polyfit
y1 = 363;
y2 = 21;
x1 = 47;
x2 = 482;
% Get formulas
xCoefficients = polyfit([x1, x2], [0, 10], 1)
xCoefficients = 1×2
0.0230 -1.0805
yCoefficients = polyfit([y1, y2], [-1.5, 1.5], 1)
yCoefficients = 1×2
-0.0088 1.6842
% Get values for a particular point on the image.
x_coord = 117; % Whatever...
y_coord = 79; % Whatever...
x_Value = polyval(xCoefficients, x_coord)
x_Value = 1.6092
y_Value = polyval(yCoefficients, y_coord)
y_Value = 0.9912
  2 comentarios
Trong Link
Trong Link el 18 de Nov. de 2021
Thank you for your excellent answer. The formula you gave works fine with linear scale but with logarithmic scale it doesn't seem to work well. So with logarithmic scale, how should I do?
This is my input image:
This is my output:
Is there any difference here?
Image Analyst
Image Analyst el 18 de Nov. de 2021
You'll have to develope a calibration formula so you'll need more than 2 points. Then you can use fitnlm to fit a curve to the log values. I'm attaching a few examples. Modify one of them to use the log formula.

Iniciar sesión para comentar.

Más respuestas (1)

yanqi liu
yanqi liu el 18 de Nov. de 2021
Editada: yanqi liu el 18 de Nov. de 2021
sir, please check the follow demo:
https://mp.weixin.qq.com/s?__biz=MzU5NTAyMTIzOQ==&mid=2247485036&idx=1&sn=6b92275258f1532398eb09602825c5f0&chksm=fe791ab4c90e93a21ee3e235b3a4fab3d13ca6db06cb2fa5ed8c9f799d320232748ed604232d&scene=21#wechat_redirect
it use click to get points
  2 comentarios
Image Analyst
Image Analyst el 19 de Nov. de 2021
@Tung Vu There are some graph digitizing apps in the File Exchange with source code. Note that this one and probably the others don't handle semi-log data.

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by