Page 1 of 1

Question about demosaicing alogrithm

Posted: Sun Dec 19, 2021 9:00 am
by aqqz
In test_camera example, why the output RGB888 image color is so green ? Can I improve it ?

Re: Question about demosaicing alogrithm

Posted: Mon Dec 20, 2021 11:04 am
by gemenerik
Hi aqqz,

Can you share the output image? If the colors are far off, perhaps the demosaicing is applied with a wrong shift, thus interpreting the colors wrong.
If the green tint is subtle, this might be improved with a better demosaicing algorithm. The current one is very basic.
For further reading check out this blogpost

Re: Question about demosaicing alogrithm

Posted: Mon Dec 20, 2021 1:01 pm
by aqqz
Hi, gemenerik :

So, this the raw image:

Image

and this is the RGB888 output image:

Image

Is it so green ?

I see the blog, In fact, I want to use the aideck to regnoized color. but I don`t use the image dataset capture from the aideck to train models.

I don`t know if there is some wrong with the demosaicking algorithm or the cmos can not show the true color of the world.

Re: Question about demosaicing alogrithm

Posted: Tue Dec 21, 2021 1:34 pm
by marcus
Could you try to using this Ptyhon script on the raw image instead? This will use openCV to do the demosaicking. Do you get the same result?

Code: Select all

import numpy as np
import cv2

img = np.fromfile("img.raw", dtype=np.uint8)
print(img.size)
img.shape = (244, 324)

rgb = cv2.cvtColor(img, cv2.COLOR_BayerBG2BGRA  )

cv2.imshow('Bayer', img)
cv2.imshow('RGB', rgb)
cv2.waitKey()
cv2.destroyAllWindows()