Perhaps bank0 and bank1 (and r, g, and b) need to be declared as unsigned chars? Maybe bank0 and bank1 are getting swapped or out-of-sequence?
Your red channel results looks like it has less resolution than the blue, too. Are the posted images supposed to be scaled to 6 or 8 bits? Do you want the r, g, and b values to have the same nominal scale (6 bits)? Do you want them in the upper or lower 6 bits of each byte?
Double check your channels with an image that has black and white patches plus a red 'R', green 'G', and blue 'B', etc.
P.S. your <<code>>
tag needs to be on its own line.
The OV7670 module with FIFO gives me bad color data. In particular, I use it in RGB565 mode, the green is the channel where I get what looks like an error: it seems that the 4th bit of the 6-bit green color data is stuck in "1" position; it never changes throughout the image, even if I put a lens cap to have a dark image. I have tried many many registers settings, and even tried the YUV colorspace instead of RGB565. Here you are G,R,B channels separately. It is clear that the green channel is wrong; using ImageJ to plot the pixels, I can count a mere 4 shades of green (they should be 64).
Green channel: Red channel: Blue Channel:
Do you have an idea of what' s going wrong? It should be EVERYTHING ok, registers, timing, color data conversion. The camera configuration code is at: https://os.mbed.com/users/rulla/code/OV7670_ok/#f5f5d7c979cf , while the piece of code I use to convert data bytes to color is:
<<code>> bank0 = cam.ReadOneByte(); bank1 = cam.ReadOneByte(); r=((bank1 & 0x1f)) ; g= ((bank1&0xe0)>>5 ) |((bank0&0x7)<<3); b=((bank0 & 0xf8)>>3 ); <</code>>
Thank you all for your time!