Re: [libdc] reading mono16?
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: Leif A. <le...@ad...> - 2015-03-09 03:23:33
|
On 09/03/15 02:58, Damien Douxchamps wrote: > Hi Leif, > > On Mon, 2015-03-09 at 01:44 +0100, Leif Adelw wrote: >> Dear fellow firewires, >> I have a set of AVT cameras that I need linux access to. I've been >> trying to fetch 16 bit images and dumping them into opencv, cimg or pgm >> files. So far I've only been able to extract 256 grayscales from frames >> irregardless of "color coding". Is there anyone that can throw an >> example at me (I've looked at and compiled the grab_*.c and avt_* >> examples from libdc1394)? > The "color coding" setting is only available for customizable image > formats ("format7", see the definition of dc1394video_mode_t in > dc1394/types.h). It won't have any effect if you are streaming a > "standard" image format. You could try using these "standard" image > format first such as DC1394_VIDEO_MODE_1600x1200_MONO16 (or another > resolution supported by your camera). > >> BUT when dumping raw files with coriander I clearly see a difference >> if choosing a 16 bit format. > You see a difference but it still doesn't work, right? > >> Reading 8 bit with e.g., {octave, >> a=fread(fid,[640 480],'uint8');} is fine but 16 bit raw file with >> {octave,a=fread(fid,[640 480],'uint16');} yield "nonsense". Is this >> rather a 14bit x 640 x 480 stream that needs to be dealt with, i.e. >> rather than beeing packed in 16 bit containers? > There is no such packing for 14 bits formats; it is sent as a 16bit > integer. However, for historical reasons some manufacturers populate the > LSBs while others populate the MSBs. You can verify this if you are > using a format7 format: in the first case they should set the data depth > to 14, in the second case it should be 16. You can get this data depth > with a call to dc1394_format7_get_data_depth(). > > Thanks, Damien I just read the http://damien.douxchamps.net/ieee1394/libdc1394/iidc/IIDC_2.0.pdf doc (p. 100). Seems as if (reading coriander 16 bit raw with octave): --- fid=fopen('test-0000000004.raw','rb'); a=uint16(fread(fid,[640 480],'uint16')); %one of the "standard" format reported by mensioned camera b=swapbytes(a); --- ,results in a correct 16 bit array/image. Moreover, dc1394_format7_get_data_depth() report 14 bits in my case, hence LSB. I'll alter my code and report back after some hours of sleep. Thanks, again Best Regards, Leif Adelöw |