I also have the Hue HD cam, and I just tried the patch Brian posted.
The result: the colors look a little different (greens and purples
instead of reds and browns), but now they seem to fluctuate every few
frames, which did not happen before the patch. The picture is still
very grainy. So I guess it's not SGRBG8.

On Jan 12, 12:03 am, "Brian Johnson" <[email protected]> wrote:
> Hmm. so if i'm understanding you it seems that this sensor is
> outputting SGRBG8 instead of SBGGR right? In that case could you try
> the following patch. It should according to the sensor specs cause the
> sensor to start its readout one row later, giving you the expected
> BGGR layout hopefully....
>
> On Sat, Jan 10, 2009 at 10:39 AM, wangrui <[email protected]> wrote:
>
> >> And here I what I look like if you are a Clique Communications "Hue HD" 
> >> cam.
>
> > Hi, I bought nine HUE cameras yesterday. I will start working on it
> > until it can be used in linux. After some trying, I finally can see a
> > colored video now. I'm using the V4L2_PIX_FMT_SBGGR8 format, in the
> > source code it said
> >        {
> >                .pix_fmt = V4L2_PIX_FMT_SBGGR8,
> >                .desc = "Bayer 8bit (BGGR)",
> >                .depth = 8,
> >                .set_format = sn9c20x_set_raw,
> >        },
> > It sounds like the pixel is arranged by BGGR. But after I tried, the
> > color pixel is actually arranged in the following way,
> >  G R G R ...
> >  B G B G ...
> >  ...
>
> > So the following java code can successfully decode it to a colored
> > picture,
> >        private void decodeSBGGR8(byte[] bs, BufferedImage image) {
> >                boolean evenRow = true;
> >                int[][] is = new int[width + 2][height + 2];
> >                for (int y = 0; y < height; y++) {
> >                        for (int x = 0; x < width; x++) {
> >                                is[x][y] = bs[y * width + x] & 0xFF;
> >                        }
> >                }
> >                for (int y = 1; y <= height; y++, evenRow = !evenRow) {
> >                        boolean evenColumn = true;
> >                        for (int x = 1; x <= width; x++, evenColumn = 
> > !evenColumn) {
> >                                int data = is[x][y];
> >                                int lr = (is[x - 1][y] + is[x + 1][y]) >> 1;
> >                                int tb = (is[x][y - 1] + is[x][y + 1]) >> 1;
> >                                int r, g, b;
> >                                if (evenRow) {
> >                                        // G R
> >                                        // B G
> >                                        if (evenColumn) {
> >                                                r = lr;
> >                                                g = data;
> >                                                b = tb;
> >                                        } else {
> >                                                r = data;
> >                                                g = (lr + tb) >> 1;
> >                                                b = (is[x - 1][y - 1] + is[x 
> > + 1][y - 1]
> >                                                                + is[x - 
> > 1][y + 1] + is[x + 1][y + 1]) >> 2;
> >                                        }
> >                                } else {
> >                                        // G R
> >                                        // B G
> >                                        if (evenColumn) {
> >                                                r = (is[x - 1][y - 1] + is[x 
> > + 1][y - 1]
> >                                                                + is[x - 
> > 1][y + 1] + is[x + 1][y + 1]) >> 2;
> >                                                g = (lr + tb) >> 1;
> >                                                b = data;
> >                                        } else {
> >                                                r = tb;
> >                                                g = data;
> >                                                b = lr;
> >                                        }
> >                                }
> >                                int rgb = 0;
> >                                rgb = (r << 16) + (g << 8) + b;
> >                                rgb |= 0xFF000000;
> >                                image.setRGB(x - 1, y - 1, rgb);
> >                        }
> >                }
> >        }
>
> > I can't find out how to decode V4L2_PIX_FMT_YUV420 and
> > V4L2_PIX_FMT_YUYV. And V4L2_PIX_FMT_JPEG returned an gray image. Maybe
> > there is some way to turn it into an colored image.
>
> > Two important things are missing for this camera
> > 1. exposure. Currently the function dev->camera.set_auto_exposure and
> > dev->camera.set_exposure for MT9M111 are both NULL.
> > 2. change video size
>
>
>
>  0001-Start-mt9m111-sensor-readout-1-row-later.patch
> 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
Lets make microdia webcams plug'n play, (currently plug'n pray)
To post to this group, send email to [email protected]
Visit us online https://groups.google.com/group/microdia
-~----------~----~----~----~------~----~------~--~---

Reply via email to