Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: another image problem

  • To: mathgroup at
  • Subject: [mg57010] Re: [mg56975] another image problem
  • From: Mark Holt <mark_robert.holt at>
  • Date: Thu, 12 May 2005 02:33:23 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

At 10:25 11/05/2005, you wrote:
>Let's say you have a picture of two overlapping graphs.
>You don't have the equations that generated them. but you know the
>graphs is relatively accurate. for example,
>Now... let's say you wanted to find the area under curve for both
>curves (blue and green) between certain x values...
>for example, 425nm <= x <= 475nm , and then 500nm <= x <= 550nm, and
>then 525nm <= x <= 575nm.
>is this doable in Mathematica?
>thanks In advance for any thoughts.

Hi Sean,
I'm a relative novice with Mathematica, so this may be complete rubbish! 
Apologies if it is.

What I have done is to crop the graph in Adobe Photoshop at the origin 
{400,0}. Then I have thresholded each channel (RGB) to give pure green and 
cyan on a white background and save as a TIFF file (graph.tif). Then I run 
the following code:

graph = Import["C:\\Documents and Settings\\Mark\\Desktop\\graph.tif"];

Show[graph, Frame -> True]

data = Position[graph[[1, 1]], {0, 255, 0}]; (*{0, 255, 0} for green; {0, 
255, 255} for cyan*)

maxy = Max[data /. {x_, y_} -> y];
maxx = Max[data /. {x_, y_} -> x];

fit = Cases[Mean /@ Table[Cases[data, {x_, i}], {i, maxy}], {x_, y_}];
int = ListInterpolation[fit, {{1, maxy}, {1, maxx}}];

datafit = Table[int[i, 1], {i, maxy}] // N;

origin = 400;
Plus @@ Take[datafit, {500 - origin, 550 - origin}]

I hope this is what you are after.

Best wishes,


  • Prev by Date: Re: Output to a file
  • Next by Date: GramSchmidt problem
  • Previous by thread: Re: another image problem
  • Next by thread: Re: another image problem