Searching \ for '[OT] RGB from bayer mask' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=rgb+bayer+mask
Search entire site for: 'RGB from bayer mask'.

Exact match. Not showing close matches.
PICList Thread
'[OT] RGB from bayer mask'
2005\12\02@234957 by Mario Mendes Jr.

flavicon
face
Hi guys,

Does anyone here know how to get RGB from a Bayer mask image?  Given the
array bellow,

  1   2   3   4   5   6
1  G   B   G   B   G   B
2  R   G   R   G   R   G
3  G   B   G   B   G   B
4  R   G   R   G   R   G
5  G   B   G   B   G   B
6  R   G   R   G   R   G

How  do you get this?

   1   2   3   4   5   6
1  RGB RGB RGB RGB RGB RGB
2  RGB RGB RGB RGB RGB RGB
3  RGB RGB RGB RGB RGB RGB
4  RGB RGB RGB RGB RGB RGB
5  RGB RGB RGB RGB RGB RGB
6  RGB RGB RGB RGB RGB RGB

I've tried google but I haven't been able to find anything yet.

Thanks.


-Mario


2005\12\03@004959 by Marcel Duchamp

picon face
Mario Mendes Jr. wrote:
{Quote hidden}

Mario,

You ask the most interesting questions!

Here is what I found on Wikipedia:
http://en.wikipedia.org/wiki/Calculating_RGB_values

Does this article show the way or ???


2005\12\03@014125 by Gaston Gagnon

face
flavicon
face
Mario Mendes Jr. wrote:

{Quote hidden}

Have you seen this?
http://www-ise.stanford.edu/~tingchen/main.htm
Gaston

2005\12\03@015008 by Mario Mendes Jr.

flavicon
face

"You ask the most interesting questions!"

Hahahahaha, sometimes I don't know if that is good or bad.  Good because
I get to learn a little more, but bad be cause now I feel compeled to
spend some money on another pic project that will cost 3 times as much
as if I were to by a web cam at the store =)


Anyway, I found this other site that has a nice visual description
(scroll half way down the page) of the process along with some more info
on white balancing and the like:

http://www.siliconimaging.com/RGB%20Bayer.htm

Thanks.


-Mario


{Original Message removed}

2005\12\03@020509 by Mario Mendes Jr.

flavicon
face
Very nice. Thanks.

-Mario


{Quote hidden}

2005\12\03@094147 by olin piclist

face picon face
Mario Mendes Jr. wrote:
> Does anyone here know how to get RGB from a Bayer mask image?  Given the
> array bellow,
>
>   1   2   3   4   5   6
> 1  G   B   G   B   G   B
> 2  R   G   R   G   R   G
> 3  G   B   G   B   G   B
> 4  R   G   R   G   R   G
> 5  G   B   G   B   G   B
> 6  R   G   R   G   R   G

I've never heard of a "Bayer" mask, but why can't you just interpolate the
missing components?  This sounds like the obvious brute force way.  Have you
tried it?

When green is not present, it's the average of the 4 surrounding green
pixels.  For red and blue, it's the average of either the two above/below or
left/right or the four corners.  There are probably more clever ways, but
this is to trivial I would try it first and see if it's good enough.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\12\03@133012 by Marcel Birthelmer

flavicon
face
Bayer grid is usually what you get from CCD/CMOS sensors. All digital
Cameras interpolate from that format to RGB/YUV. Usually the equation is
 a second-degree one (at least) so that you weigh the proximal few
layers of the missing color by distance (like a gaussian filter, sort
of) to get the missing components.
- Marcel

Olin Lathrop wrote:
{Quote hidden}

2005\12\03@140948 by olin piclist

face picon face
Marcel Birthelmer wrote:
> Bayer grid is usually what you get from CCD/CMOS sensors. All digital
> Cameras interpolate from that format to RGB/YUV. Usually the equation is
>  a second-degree one (at least) so that you weigh the proximal few
> layers of the missing color by distance (like a gaussian filter, sort
> of) to get the missing components.

That makes sense when you want to resample independently of the original
pixel grid.  However in the case show if you just want the full RGB at the
existing pixel locations, the 3rd order fit will most likely reduce to what
I suggested.  At most you will have very weak contributions from farther
pixels, but I doubt that's a good idea.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\12\03@171542 by Peter

picon face


On Fri, 2 Dec 2005, Marcel Duchamp wrote:

{Quote hidden}

Notice that there are N G values, N/2 R values and N/2 B values. Thus
you can produce a G value for each 2nd pixel and a R and B value for
each 3rd pixel. This is the price to pay for not using 3 image pickups
(as pro cameras do). If yuu squint you can see that you get two G's and
one each R and B from each 'square' formed by pixels 0,0 0,1 1,0 1,1
etc. There are several ways to do it but a simple way is to divide the
matrix into squares of 4 pixels and then:

row0:

Or(0,0) = I(1,0)
Og(0,0) = I(0,0)
Ob(0,0) = I(0,1)

Or(0,1) = I(1,0)
Og(0,1) = I(1,1)
Ob(0,1) = I(0,1)

Or(0,2) = I(1,2)
Og(0,2) = I(0,2)
Ob(0,2) = I(0,3)

Or(0,3) = I(1,2)
Og(0,3) = I(1,3)
Ob(0,3) = I(0,3)

...

On row 1 you use info from row 2 and so on. It's a hack. Later you can
use the bilinear interpolation aluded to in the wikipedia article.

Peter

2005\12\03@173511 by Peter

picon face

On Sat, 3 Dec 2005, Olin Lathrop wrote:

{Quote hidden}

The original idea behind the Bayer filter was to get a signal that could
lead to the reconstruction of TV Y,R-Y,B-Y signals with simple *analog*
means in 1950's or so. That is why it is organized like that (the other
reason is that the filter is made by masking stripes in 3 colors onto a
substrate - much like stripe crts are better than delta crts).

The original extraction required frequency domain filtering (of the
signal coming from a vidicon). The G signal would have maximum frequency
and it would be modulated by the frequency of the stripes (as scanned
horizontally). Then a simple PLL locked to this frequency (or in ultra
cheap designs just peaking and limiting) and one H period delay line
would be enough to recover R-Y and B-Y using 2 synchronous modulators
driven by the G high frequency signal. In a CCD camera the PLL is not
necessary as the pixel clock is well known and derived from the main
timing chain.

Peter

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...