KCK
KCK

Reputation: 2033

Understanding the output of raw_pattern in rawpy

I have the following two examples when loading 2 different raw images (one with Nikon and another with Sony Both having Bayer filters):

Nikon RAW image

Sony RAW image

Can someone please explain the meaning of the output of the raw_pattern here along with difference in the outputs of the examples provided.

Upvotes: 2

Views: 1436

Answers (2)

Yang
Yang

Reputation: 309

Code to get bayer partten string

import rawpy, numpy as np
raw_obj = rawpy.imread("xxx.dng")
bayer_partten = "".join([chr(raw_obj.color_desc[i]) for i in raw_obj.raw_pattern.flatten()])

Upvotes: 2

Tomi Aarnio
Tomi Aarnio

Reputation: 2527

The Nikon (NEF) pattern means "GBRG" and the Sony (ARW) pattern means "RGGB", assuming that a.color_desc == "RGBG". So the integers in raw_pattern are indices to color_desc.

Upvotes: 1

Related Questions