Re: importing image and getting numbers from the gray intensity
- To: mathgroup at smc.vnet.net
- Subject: [mg49406] Re: importing image and getting numbers from the gray intensity
- From: sean_incali at yahoo.com (sean kim)
- Date: Sat, 17 Jul 2004 06:40:12 -0400 (EDT)
- References: <cd5okp$b2c$1@smc.vnet.net> <cd8b5g$olp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Paul,
Thanks for the reply,
I can't seem to get this to work.
I copied, pasted, converted and renamed it to pixel.
but when i go...
In[74]:=
pixels=First[
Cases[pixels,RasterArray[x__]:>x,Infinity]]/.RGBColor[r_,g_,
b_]:>(r+g+b)/3
From In[74]:=
First::first: {} has a length of zero and no first element.
Out[73]=
First[{}]
Thanks for any thoughts in advance
sean
Paul Abbott <paul at physics.uwa.edu.au> wrote in message news:<cd8b5g$olp$1 at smc.vnet.net>...
> 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