Re: Image Processing
- To: mathgroup at smc.vnet.net
- Subject: [mg66110] Re: Image Processing
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sat, 29 Apr 2006 03:41:21 -0400 (EDT)
- References: <e2srgo$3bv$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Charlie Springer wrote:
> Hi all.
>
> Old physicist, new Mathematica user.
>
> I want to perform 2D FFT's on images. I have used Import to get a JPEG into
> apparently, a graphic object. I can not see how to get it into a "list of
> lists" or any form acceptable to Fourier[].
>
> Anybody have a snippet or some experience? I'm still learning the
> terminology. If this works out I'll get the grid version for a Mac Quad.
>
> -- Charlie Springer
>
Hello,
When you import a JPEG file you end up with a Graphics object, whose
structure is suppressed for convenience by the FrontEnd, but it is easy
to examine, taking care not to spill a super large set of numbers into
the notebook:
image=Import["something.jpeg"];
image//InputForm//Short
Graphics[Raster[{{{73, 54, 0}, {72, 53, 0}, {<<3>>}, <<96>>, {55, 37,
1}}, <<34>>}, <<3>>], <<3>>]
So image[[1,1]] is a 2-D array of colour triples - which you can boil
down to a single number (e.g. by summing them to get a gray scale) and
apply the Fourier transform.
Note that although other types of images - such as GIF - import as a
Graphics structure, the internal structure is not the same (but there
are some GIF-specific Import options to solve this if you require them).
David Bailey
http://www.dbaileyconsultancy.co.uk