Thanks for all the replies so far,
I have taken your advice and have taken a DNG raw image, although I have some confusion when compared to my first method
Firstly, can I confirm the following code gets the raw camera data as an array?As far as I'm aware, the raspberry pi camera 3 has a RGGB bayer filter, so the pixels should be arranged like:
RGRGRGRGR...
GBGBGBGBG...
So in order to get separate the red, blue, and green channels, I should use the following code:However, when I compare my red channel using this method to the red channel of the DNG raw file using RawTherapee, they appear different. It's as if my above code is retrieving the wrong colour channel (blue instead of red etc.)
I have taken your advice and have taken a DNG raw image, although I have some confusion when compared to my first method
Firstly, can I confirm the following code gets the raw camera data as an array?
Code:
raw picam2.capture_array("raw").view(np.uint16)
RGRGRGRGR...
GBGBGBGBG...
So in order to get separate the red, blue, and green channels, I should use the following code:
Code:
rgb = np.zeros(raw.shape + (3,), dtype=raw.dtype)rgb[0::2, 0::2, 0] = raw[0::2, 0::2] # Red rgb[0::2, 1::2, 1] = raw[0::2, 1::2] # Green rgb[1::2, 0::2, 1] = raw[1::2, 0::2] # Green rgb[1::2, 1::2, 2] = raw[1::2, 1::2] # Blue
Statistics: Posted by Harisunn_ — Thu Jan 04, 2024 1:43 am