comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Reading Raw Image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reading Raw Image [message #55840 is a reply to message #55839] Thu, 20 September 2007 09:05 Go to previous messageGo to previous message
weitkamp is currently offline  weitkamp
Messages: 33
Registered: October 1998
Member
rpertaub@gmail.com wrote:

> I have a .raw image file from a lumenera camera that I am trying to
> open. It is a 10-bit image (1280x1024). The total bytes is 7864320
> (1280x1024x6) (not sure why that is).

If this is a color image, then it is probably because you have 3 color
channels (most likely red, green, and blue). For each channel, you
need 2 bytes to store 10-bit data. Makes 6 bytes per pixel. Now the
remaining question is how the channels / pixels are ordered in your
image. You need to find this out by trying.

> I tried using read_binary with data_dims =[1280,1024] but the image is
> just snowy...not what I expect to see.

The easiest to read the file into IDL is probably to use an unsigned
integer array of dimensions [1280, 1024, 3] or a permutation of these.
Something like this (I didn't test):

imgdata = uintarr(1280, 1024, 3)
openr, 1, 'yourfile.raw'
readu, 1, imgdata
close, 1

You can then try to display an individual channel, for example
imgdata[*, *, 0] or. If you only get snow as you describe, there may
be essentially two reasons (or a combination of the two):

(a) The byte order of the long integers is wrong. You can reverse this
with the "byteorder" command:

byteorder, imgdata

and then try again. (This is, however, not likely to be the reason if
the images were both written on computers of the same architecture,
for example on an IBM-PC compatible architecture.)

(b) Or the dimensions are not ordered correctly in the data (i.e., you
chose the wrong permutation of your three dimensions). In that case,
try something like

imgdata = reform(imgdata, 1280, 3, 1024)

or any other permutation of the dimensions, and then try displaying a
channel again.

Good luck
Timm
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Where is textoidl?
Next Topic: Reference counting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:35:59 PDT 2025

Total time taken to generate the page: 0.00466 seconds