Retrieve Bayer CFA pattern.


Sorry if this has been posted before! I would like to know if there is an API call to retrieve what is the Bayer CFA pattern ('RGGB', 'BGGR', 'GRBG', 'GBRG'. I ) on a given image. Dcraw can be called with -v -i and will output the pattern, RG/GB for example here:

Filename: DSC_2475.NEF
Timestamp: Wed May 7 11:37:55 2014
Camera: Nikon D800
ISO speed: 100
Shutter: 1/2000.0 sec
Aperture: f/10.0
Focal length: 16.0 mm
Embedded ICC profile: no
Number of raw images: 1
Thumb size: 7360 x 4912
Full size: 7424 x 4924
Image size: 7378 x 4924
Output size: 4924 x 7378
Raw colors: 3
Filter pattern: RG/GB
Daylight multipliers: 2.099064 0.928145 1.096731
Camera multipliers: 2.378906 1.000000 1.128906 0.000000




imgdata.idata.cdesc contatins

imgdata.idata.cdesc contatins color description string (RGBG or CMYG)

Use dcraw-like code to output it, substitute fcol() with COLOR()

-- Alex Tutubalin

Thanks Alex!

Thanks Alex!

I'm coming back on that one,

I'm coming back on that one, I wanted to know how imgdata.idata.cdesc returns the CFA pattern: Is it in clock-wise order or on a per row basis?:

Taking RGBG and respective 1-based indices is it:

1 2
4 3


1 2
3 4

It seems to me that it is in clock-wise order but I would like confirmation.



Looks like it is actually the

Looks like it is actually the duty of imgdata.idata.filters to provide that order.