MathGroup Archive 2004

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

Search the Archive

Re: importing image and getting numbers from the gray intensity

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49371] Re: importing image and getting numbers from the gray intensity
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 16 Jul 2004 06:07:05 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <cd5okp$b2c$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <cd5okp$b2c$1 at smc.vnet.net>,
 sean_incali at yahoo.com (sean kim) wrote:

> let's say you have an image of gray bands of varying intensity. 
> 
> such as the one seen on the website, 
> 
> http://encyclopedia.thefreedictionary.com/SDS-PAGE 
> 
> Is there anyway to change the picture or do something and be able to
> get numerical values for those bands?
> 
> maybe define a vertical line and then go to the center of the each
> bands and measure how intense the gray is.
> 
> or maybe define a rectangle and get the gray intensity in that... 
> 
> is there a packages or codes for doing that?  NIH image program which
> is freely avaialble can do this. But I wanted to do it in Mathematica.

There are several ways to do this. One way is to copy the image, paste 
it into a Mathematica Notebook and then use

   Cell | Convert To | InputForm

This will give you an input cell that includes a RasterArray of 
RGBColors. Call this cell pixels, say, and enter it. You can then access 
the pixels as follows:

   pixels = First[Cases[pixels, RasterArray[x__] :> x, Infinity]] /. 
      RGBColor[r_, g_, b_] :> (r + g + b)/3

You can re-draw the picture as follows:

  ListDensityPlot[pixels, Mesh -> False]; 

and do any other manipulation you want on the pixels.

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: User-defined or filled symbols for Points in ListPlots and Epilogs?
  • Next by Date: Re: Help -- Weird integration behavior
  • Previous by thread: Re: importing image and getting numbers from the gray intensity
  • Next by thread: Re: importing image and getting numbers from the gray intensity