karansher / computer-graphics-raster-images

Computer Graphics Assignment about Raster Images
1 stars 0 forks source link

simulate_bayer_mosaic.cpp #15

Open casseyshao opened 2 years ago

casseyshao commented 2 years ago

Hey I am a little confused about how to do the task for this file "Simulate an image acquired from the Bayer mosaic". Is it that we only record one of either the R/G/B value at each pixel? And how do we know which (R or G or B) to record? Thanks so much in advance! EDIT: is it that we follow GBRG when choosing R/G/B value to record?

abhimadan commented 2 years ago

Yes, you have the right idea. The GBRG pattern described in the header file is a 2x2 pattern that you use to select which colour channel to keep.

MatrixDoge commented 2 years ago

I have a follow up question. The top left corner pixel of images/rgb.png is (R164, G223,B226), and the top left corner pixel of images/bayer.png is (230, 230, 230) aka grayscale 230.

If we follow the pattern in images/bayer-info.png, the top left one should be blue. And in this case, we should pick 226 as the greyscale. Based on this rule, I could generate a bayer image looks almost identical to the one in images/bayer.png but the greyscale values are a bit different from the ones in images/bayer.png

There is no way we can get a grayscale of 230 from the original rgb.png pixel (R164, G223,B226), regardless whether its GBRG or BGGR?

Could you clarify it or am I missing something here?

abhimadan commented 2 years ago

The output image doesn't need to be pixel perfect. I think that image in the readme was probably generated with a slightly different base image anyway.