フィルターのクリア

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

3 ビュー (過去 30 日間)
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?

採用された回答

Image Analyst
Image Analyst 2021 年 11 月 15 日
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 件のコメント
Trong Link
Trong Link 2021 年 11 月 18 日
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 2021 年 11 月 18 日
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.

サインインしてコメントする。

その他の回答 (1 件)

yanqi liu
yanqi liu 2021 年 11 月 18 日
編集済み: yanqi liu 2021 年 11 月 18 日
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 件のコメント
Trong Link
Trong Link 2021 年 11 月 19 日
Is there any way I can see the source code of this digitizer?
Image Analyst
Image Analyst 2021 年 11 月 19 日
@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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by