79491931

Date: 2025-03-07 10:16:24
Score: 1
Natty:
Report link

Answer inspired by a C-based Stackoverflow question:

Opencv2 can be used to read in the image and then apply de-mosaicing.

import numpy as np
import cv2 as cv

# Read camera data file
raw_img = cv.imread("KAI_img_001.png")
# Demosaic raw img using edge aware Bayer demosaicing algorithm
dem_img = cv.demosaicing(raw_img, cv.COLOR_BayerBG2BGR_EA)
# Save demosaic-ed image
cv.imwrite("DEM_img_001.png", dem_img)

There is some more information in the opencv documentation about the alternatives to the COLOR_BayerBG2BGR_EA code that I used in the example. You may need to experiment with the right one so that it interprets/converts your raw image data correctly.

Hope this is relevant/helpful :)

Reasons:
  • Blacklisted phrase (1): Stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Kiwi