Question about demosaicing alogrithm

Discussions about the AI-deck
Post Reply
aqqz
Beginner
Posts: 16
Joined: Wed Nov 18, 2020 1:40 am

Question about demosaicing alogrithm

Post by aqqz »

In test_camera example, why the output RGB888 image color is so green ? Can I improve it ?
gemenerik
Beginner
Posts: 19
Joined: Wed Apr 07, 2021 11:11 am

Re: Question about demosaicing alogrithm

Post 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
aqqz
Beginner
Posts: 16
Joined: Wed Nov 18, 2020 1:40 am

Re: Question about demosaicing alogrithm

Post 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.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Question about demosaicing alogrithm

Post 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()
Post Reply