Re: another image problem
- To: mathgroup at smc.vnet.net
- Subject: [mg57010] Re: [mg56975] another image problem
- From: Mark Holt <mark_robert.holt at kcl.ac.uk>
- Date: Thu, 12 May 2005 02:33:23 -0400 (EDT)
- References: <200505110925.FAA24119@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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>
- another image problem