Re: another image problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg57041] Re: another image problem*From*: "markholtuk" <mark_robert.holt at kcl.ac.uk>*Date*: Thu, 12 May 2005 22:44:24 -0400 (EDT)*References*: <200505110925.FAA24119@smc.vnet.net><d5uuqr$953$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

What I forgot to mention is that the image is cropped between the 400 and 650 graph ticks and the image rescaled so that the width is 250 pixels. This removes any requirement for rescaling after data extraction. Mark Holt wrote: > 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, > > > >http://pg.photos.yahoo.com/ph/sean_incali/detail?.dir=/9264&.dnm=191b.jpg&.src=ph > > > >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. > > > >sean > > 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; > ListPlot[datafit] > > origin = 400; > Plus @@ Take[datafit, {500 - origin, 550 - origin}] > > I hope this is what you are after. > > Best wishes, > > Mark

**References**:**another image problem***From:*"sean_incali" <sean_incali@yahoo.com>