Re: importing image and getting numbers from the gray intensity

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

```In article <cdb1pf\$aka\$1 at smc.vnet.net>,
sean_incali at yahoo.com (sean kim) wrote:

> I can't seem to get this to work.
>
> I copied, pasted, converted and renamed it to pixel.

pixel or pixels?

Did the renamed cell, look like

pixels = Show[Graphics[
{AbsoluteThickness[1],GrayLevel[1],
Polygon[{{4, 4},{148, 4},{148, 307},{4, 307},{4, 4}}],
RasterArray[{{
RGBColor[0.980392, 0.968627, 1],
...
}},
{{4, 4}, {148, 307}}]}],
AspectRatio->2.10417,
PlotRange->{{4, 148}, {4, 307}},
ImageSize->{144, 303}]

or did it have Raster instead (this may be version dependent)?

> 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.

This would happen if you named it pixel instead of pixels, or if you get
a Raster object instead of a RasterArray.

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: using file txt in mathematica
• Next by Date: Re: using file txt in mathematica
• 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