MathGroup Archive 2002

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

Search the Archive

Re: Reading Color Values from Images Using Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36087] Re: Reading Color Values from Images Using Mathematica
  • From: peter weijnitz <pewei at algonet.se>
  • Date: Wed, 21 Aug 2002 05:51:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have done this by saving the pic from e.g. photoshop in the raw format and then
reading it into Mathematica as binary matrix (reading the values as eight bit
integers from 0 to 255). you will get a matrix of the same size as the pic where
each element is a 3x1 vector with the color values.0 to 255 . It was done in the
pre Mathematica 3 time I suppose it can be done easier now.
If this sounds useful to you I can dig up the Mathematica code I used, I don't
have it on the computer I am using now.
Best regards

Peter W

AES wrote:

> I originally wrote
>
> > > I want to extract numerical values for the separate R, G and B channel
> > > intensities, on a pixel by pixel basis, for specific (limited) regions
> > > in color photos (JPEG, TIFF, whatever), on a Mac, preferably while I'm
> > > viewing the region I'm examining.
> > >
> > > Any readily available software to do this?  Can Mathematica do it?
>
> and Selwyn Hollis <slhollis at earthlink.net> wrote:
>
> > In Mathematica, choose Color Selector... from the Input menu. That
> > brings up the Mac Color Picker. Move your pointer anywhere on the screen
> > and option-click. That will select the color. Now click Okay, and the
> > RGBColor recipe will be pasted into the Mathematica front end.
> >
> > A similar thing works in GraphicConverter as well.
>
> Wow -- interesting -- it does work!
>
> I originally thought I'd have to get a JPEG image, say, into Mathematica
> using Import[], then Show[] it, to do this; and that does work, although
> Mathematica gets unhappy at importing JPEGs of any size, and is very slow at
> Show[]ing them.
>
> But Mathematica (on a Mac) will actually do this with an image displayed on
> screen using other graphics programs as well.  A bit tedious -- you have
> to jump back and forth between Mathematica and the image, and re-open Color
> Selector from the menu for each sample.  But, you can select and read
> off the color in any of multiple formats besides RGB.
>
> Sure would be nice if you could automate this in some fashion -- but I
> guess that's what the Mathematica Digital Image Processing package does.
>
> Damned if I can find any mention of this in the Mathematica Book or the online
> documentation.
>
> Thanks, Selwyn!



  • Prev by Date: Re: ListDensityPlot
  • Next by Date: RE: Re: Need faster way to combine arrays
  • Previous by thread: Reading Color Values from Images Using Mathematica
  • Next by thread: Null