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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Reading Raw Image [message #55838] Thu, 20 September 2007 11:49
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 20 Sep 2007 14:47:11 +0000, rpertaub@gmail.com wrote:

> Hello,
> 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).
> I tried using read_binary with data_dims =[1280,1024] but the image is
> just snowy...not what I expect to see.
> Can anyone help me with this?
> thanks,

Definitely try out DCRAW. I used it to convert some Nikon .NEF raw files
to linear 16bit TIFFs, and then analyzed the linearity of the CCD
detectors (really impressively good!).

http://turtle.as.arizona.edu/im/mdr16/linearity.html

I even wrote a 16bit dynamic range extender tool in IDL, which you can
find here:

http://turtle.as.arizona.edu/im/mdr16/

JD
Re: Reading Raw Image [message #55839 is a reply to message #55838] Thu, 20 September 2007 09:12 Go to previous message
weitkamp is currently offline  weitkamp
Messages: 33
Registered: October 1998
Member
weitk...@esrf.fr wrote:

> if the images were both written on computers of the same architecture,

Did I have too much coffee today or not enough? Anyhow: what I wanted
to say here was, "... if the image was written on a computer of the
same architecture as the one you run IDL on."

Sorry about that
Timm
Re: Reading Raw Image [message #55840 is a reply to message #55839] Thu, 20 September 2007 09:05 Go 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
Re: Reading Raw Image [message #55842 is a reply to message #55840] Thu, 20 September 2007 08:14 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Sep 20, 2:47 pm, "rpert...@gmail.com" <rpert...@gmail.com> wrote:
> Hello,
> 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).
> I tried using read_binary with data_dims =[1280,1024] but the image is
> just snowy...not what I expect to see.
> Can anyone help me with this?

RAW is not a format, it is whatever the camera manufacturer chooses it
to be (today). Dave Coffin has a tool that may help you [1], but
converting the image to 16 bit tiff (in Photoshop, Adobe Camera RAW,
or a similar tool) seems to be your best bet. Many cameras apply some
sort of lossless compression on the RAW images.

Maarten

[1] http://cybercom.net/~dcoffin/dcraw/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Where is textoidl?
Next Topic: Reference counting

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

Current Time: Wed Oct 08 15:23:19 PDT 2025

Total time taken to generate the page: 0.00501 seconds