OV7670: Why does the test pattern work, but the colors of a picture are wrong?

1.1k views Asked by At

I am working with the OV7670 camera module connected to an FPGA (Cyclone V DE0-CV board). When outputting the 8-bar color bar test pattern, everything is fine. To output the test pattern, register 0x71 is set to 0xB5.

The 8-bar color bar test pattern.

When trying to output an actual image, the colors are all wrong. The greyscale is fine, as can be seen below (I am not expecting higher quality from a module like this).

The greyscale image.

The colors are usually very pink-ish, and not many other colors are visible. This can be seen below. The resolution is not the issue, that is on purpose.

The miscolored image.

As the motive is clearly visible, this suggests that the Y-component of the YUV-data is correct, but that is not the case with the chrominance.

The motive of the image can be seen here to get a feel of what the colors should be.

The actual motive of the image.

The configurations I have played around with can be seen below. I have tried a lot of different combinations of these. configReg() sets a specified register (first parameter) to a specified value (second parameter).

configReg(0x12, 0x80); //Software reset, YUV

configReg(0x1E, 0x31);  //Flip image vertically
configReg(0x13, 0x81); //Auto gain enable, White balance enable, Auto exposure enable
configReg(0x3f, 0x01 ); //Edge enhancement factor 

configReg(0x70, 0x3A); // Enable pattern
configReg(0x71, 0x35 | 0x80); // Enable pattern

configReg(0x3A, 0x1D); // Fixed MANU, MANV
configReg(0x3D, 0x88 | 0x40); // UV saturation

Could it be a saturation problem due to the lighting? I am not misinterpreting the signals from the camera, as the test pattern is correct.

1

There are 1 answers

1
Zim On

correct test pattern The test pattern is wrong. It should be like in the image attached.