|
[Date Index]
[Thread Index]
[Author Index]
Re: importing images
- To: mathgroup at smc.vnet.net
- Subject: [mg8559] Re: [mg8503] importing images
- From: Fabian Haas <b5hafa at rz.uni-jena.de>
- Date: Sat, 6 Sep 1997 23:16:23 -0400
- Sender: owner-wri-mathgroup at wolfram.com
>Greetings everyone,
>
> I am trying to utilize Mma 3.0 in my Image Processing course and have
>run into a bit of a snag. It seems that it can DISPLAY many forms of
>graphics, but I wish to be able to, say, import a 8-bit grayscale *.gif
>file into mma as a matrix of grayscale values. The same would apply to
>jpeg, tiff, and bmp files as well. Has anyone done this or is there a
>kind soul who could shed some light on this subject for me? Thanks in
>advance.
>
>--
>Al Arduengo
>exal at texas.net
>http://lonestar.texas.net/~exal
Hi Al,
there are ways to do that: convert the images to RAW data and then you can=
read them in using following function:
ReadPic8[filename_String, rows_Integer, cols_Integer] := Module[{goodbytec=
ount = rows*cols, pic, actual, fp}, actual = FileByteCount[filename];
If[actual != goodbytecount, Print["File not of correct size or missing."];
Abort[]];
fp = OpenReadBinary[filename, FilenameConversion->Identity]; pic ==
ReadListBinary[fp, Int8];
Close[fp];
pic = N[Partition[pic,cols]];
Return[pic]
];
The function has been written by Mark Evans by the way. I modified it a=
little to
<<Utilities`BinaryFiles`
Clear[ ReadPic8]
ReadPic8[filename_String, rows_Integer, cols_Integer] :=
Module[{goodbytecount = rows*cols},
actual = FileByteCount[filename];
fp = OpenReadBinary[filename];
pic = ReadListBinary[fp, Int8];
Close[fp];
pic = N[Partition[pic,cols]];
Return[pic]
];
The other way seems to be the MovieDigitizer distributed through MathSource.=
This small programme is capable of importing picture/pixels from QuickTime=
movies and runs on Macs.
Hope it helps
=46abian
-------------------------------------------------------------------------
Dipl.Biol. Fabian Haas, MPhil
Institut f=FCr Spezielle Zoologie und Evolutionsbiologie
Erbertstr. 1
D-07743 Jena
b5hafa at pop3.uni-jena.de
http://www.zoo.uni-jena.de/~fabian/
Deutschland / Germany
TEL ++ 49 3641 630 424
=46AX ++ 49 3641 630 392
:-) (-:
-------------------------------------------------------------------------
Prev by Date:
Re: lists of pairs
Next by Date:
RE: Q: Union and precision.
Previous by thread:
Re: importing images
Next by thread:
Re: REQ: Algorythm for combinations
|