OV7620 RGB demosaicing problem

Hello,

I'm working on an imaging system which uses C3188A digital cmo camera(contains OV7620 image sensor). It is controlled by a PIC18F452 an each frame I want to view is stored in a FIFO buffer, AL422B. I can stor a frame and transfer it to my PC by RS232. However I have a problem wit the images, they look gray scale although they should be RGB. I have configured OV7620 to transmit QVGA images in progressive mode. haven't changed the data mode, it's repetitive because one-line outpu format is not supported in qvga mode. The camera is configured to outpu raw data also. Anyway, when I display the bayer pattern in bmp format, I see that colo sensors do not seem to work properly. I display each pixel as below: The bayer pattern form is: B G B G G R G R bmp file form is: (0, 0, B), (0, G, 0), (0, 0, B), (0, G, 0) (0, G, 0), (R, 0, 0), (0, G, 0), (R, 0, 0) This is just for test purposes. I want to see red things red, blue thing blue and green things green however the sensor doesn't seem to sense the in that way, they all look the same color which is greenish. I have als converted bayer pattern into RGB and saw that the image is completely gra scale although the sensor is configured for raw data output(it looks lik that each components digital value is so close to each other that when components are combined it gives a gray scale pixel). Because the image i QVGA and it is outputted in repetitive format 2 bytes are sent for eac pixel, am I right? So, I should be receiving 153600 pixels(320 x 240 x 2 and this is exactly what I count during the transfer. So there shouldn' be any pixel missing issue. Moreover the camera is connected to the FIF memory directly so they synchronize each other by hardware therefore ther shouldn't be any problems caused by software. Other than that I couldn' find any way to resolve that issue, could anybody help me in tha problem??

Thanks!!

Taskin Baltaci

Reply to
ksanthos
Loading thread data ...

Doesn't the OV7620 output pixels in the YUV colorspace by default? Are you commanding the sensor to switch to RGB mode (by sending an I2C cmd to change an internal register...I don't recall which one off the top of my head, but its clear in the datasheet)? Also, are you using both the Y pixel bus and the UV pixel bus, or just the Y pixel bus?

Regards, John O

formatting link

Reply to
john.orlando

Hello,

first of all thanks for the response! I'm using 8 bit so I'm tristatin the UV bus. And I also set the color space to RGB, I have used the belo I2C commands to configure the chip:

I2CWrite(0x11, 0b00000000); //slow down pclk (0x00 + 1) times(defaul value) DelayMs(50); I2CWrite(0x12, 0b00101100); //output raw data, enable AWB DelayMs(50); I2CWrite(0x13, 0b00100001); //8 bit data format, enable auto adjust mode DelayMs(50); I2CWrite(0x14, 0b00100100); //ucResCtrlSet detayi main()'in yukarisinda DelayMs(50); I2CWrite(0x28, 0b00100000); //Progressive scan mode(default i interlaced), repetetive mode! DelayMs(50); But I'm confused in a point. If I tristate the UV bus, shouldn't it sto outputting any signal? I mean, shouldn't it be low all the time? Becaus when I check it by scope I see some irregular signals on the pin.

and

store

with

I

output

Reply to
ksanthos

Seems inappropriate register setting to me, have you signed NDA with OV? If not then i don't think you would be able to get very details.

Just a wild guess, ali

Reply to
Ali

Hmm this module has OV7620 and a FIFO chip. Hve you told the FIFO that it is only getting 8 bit data mux stream?

I suspect half of the problem is you are only adjusting half of the unit and the other half expects 16 bit data still.

That is if the serialiser can work with 8 bit mux data on faster clock.

Set AGC and AWB on Raw data on output

16/8 bit mode (bit 4) is at 16 bit setting.
8 bit mode and auto-adjust mode Data format CCIR601 (16bit)

AWB low threshold QVGA (320 x 480) HREF positive RGB Gamma on

No register 15 to match the FIFO to which phase of pixel clock clocks data byte.

At least read register 15 and find out what it is set to!

HINT in 8 bit mode the clock is twice as fast! You may be clocking the data into the FIFO on the WRONG EDGE.

NO regsister 27 to ensure RGB matrix is ON, otherwise your data is YUV multiplexed.

Dual line repetitive mode as well.

I do not beleive you have fully set the device up and may also have some stray pickup or signal being injected from the serialiser which is expecting 16bit data.

See more comments below.

How is data clocked into the FIFO, for 8 bit mode you will probably need glue logic/CPLD to ensure the data on rising and falling edges of PCLK are read correctly.

I suspect you have not fully set RGB mode or 8 bit mode fully so the Y channel is outputting Y data (hint that is greyscale).

Also I doubt you have set the FIFO (AL422B) to expect data on faster clock. So it may well be transmitting data either mainly green or Y which will appears as greyscale if only one half of the data is captured into the FIFO.

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
              GNU H8 & mailing list info
             For those web sites you hate
Reply to
Paul Carpenter

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.