Re: Beginner : how to convert .bmp or .jpeg for digital processing
- To: mathgroup at smc.vnet.net
- Subject: [mg57155] Re: Beginner : how to convert .bmp or .jpeg for digital processing
- From: "Peltio" <peltio at trilight.zone>
- Date: Thu, 19 May 2005 03:08:31 -0400 (EDT)
- References: <d6bi9d$moh$1@smc.vnet.net>
- Reply-to: "Peltio" <peltioNOSPAM at despammed.com.invalid>
- Sender: owner-wri-mathgroup at wolfram.com
"Peter van Daalen" wrote
>Being a Mathematica beginner, I failed in finding the way to convert
>..jpeg and .bmp formats into 2D and 3D numerical ( 0-255) arrays.
Don't know for 3D pictures, but as long as you stick with 2D ones (and you
have access to a version of Mathematica with Import) this should do what you want:
pic=Import["JohnDoesSkull.jpg"];
This is the array you were looking for:
vals=pic[[1,1]];
Dimensions[vals]
This shows the array by rescaling the values:
Show[Graphics[Raster[vals/Max[vals]]], AspectRatio -> Automatic]
This is an enhanced negative image
Show[Graphics[Raster[1 - vals^2/Max[vals^2]]], AspectRatio -> Automatic]
cheers,
Peltio
I hope you have plenty of RAM, since I've a hunch that an hires x-rays image
can be quite huge.