Group Abstract Group Abstract

Message Boards Message Boards

GraphImage2List: get numeric data from plot's images using image processing

POSTED BY: Kotaro Okazaki
11 Replies

Thank you for sharing. I like the way you described the plot in your prompt. It played a significant role in getting such a good prediction. So the basic rule here is to try to provide as much as we observe to the model.

POSTED BY: Ahmed Elbanna

This is very nice and useful!

Thanks.

POSTED BY: Kotaro Okazaki
Posted 5 years ago

Kotaro-san

Thank you so much for your time and effort, but sadly, it does not solve the problem. I will look into it deeper and tell you if I manage to solve it.

Again, thank you.

POSTED BY: Charlie Liu

Charlie-san,

I'm sorry I've not built an abnormal route in my tool. I don't know if the following is the problem you're facing, but an endless loop may occur when locator2coordinate function does not have unique solution from given two red points.

You may avoid the loop by changing the function to the following. Please change the location of two red points and try again.

locator2coordinate[list_, sample_] := 
 Module[{l1x, l1y, l2x, l2y, s1x, s1y, s2x, s2y, d, c, ysolve, xlist, 
   ylist},
  {l1x, l1y} = list[[1]]; {l2x, l2y} = list[[2]];
  If[l1x === l2x || l1y === l2y, Beep[]; Return[{}]];
  {s1x, s1y} = sample[[1]]; {s2x, s2y} = sample[[2]];
  ysolve = Solve[d*l1y + c == s1y && d*l2y + c == s2y, {d, c}];
  {{d, c}} = {d, c} /. ysolve;
  ({Exp[(#[[1]] - l1x)/(l2x - l1x)*(Log[s2x] - Log[s1x]) + Log[s1x]], 
       d*#[[2]] + c} & /@ list) // Sort
  ]
POSTED BY: Kotaro Okazaki
Posted 5 years ago
POSTED BY: Charlie Liu

Hello Kataro,

thank you so much for your method. It is really great.

POSTED BY: Vitaliy Reznikov
Posted 5 years ago

Thank you so much Kotaro-san!

POSTED BY: Charlie Liu

Charlie-san,

Thanks for your comment. To work for graphs that have a logarithmic scaling on the x-axis, change the locator2coordinate function below.

locator2coordinate[list_, sample_] := 
 Module[{l1x, l1y, l2x, l2y, s1x, s1y, s2x, s2y, d, c, ysolve, xlist, 
   ylist},
  {l1x, l1y} = list[[1]]; {l2x, l2y} = list[[2]];
  {s1x, s1y} = sample[[1]]; {s2x, s2y} = sample[[2]];
  ysolve = Solve[d*l1y + c == s1y && d*l2y + c == s2y, {d, c}];
  {{d, c}} = {d, c} /. ysolve;
  ({Exp[(#[[1]] - l1x)/(l2x - l1x)*(Log[s2x] - Log[s1x]) + Log[s1x]], 
       d*#[[2]] + c} & /@ list) // Sort
  ]

This is my result of your example.

enter image description here

For your reference:

POSTED BY: Kotaro Okazaki
Posted 5 years ago

Kotaro-san,

Thank you so much for this method of converting graph images into lists. I have just one question that I wish to ask: how can the locator2coordinate function be modified so that the method would work for graphs that have a logarithmic scaling on the x-axis? I'm really interested in exploring this method of yours further!

Example: logarithmic graph

POSTED BY: Charlie Liu

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard