Ov7670 register settings

Hi there,

I'm reading the ov7670 bits and I'd like to have the image in grayscale. I only need black and white as a 1 and 0 because i'm reading an arucomarker. I'm getting there, almost, but unfortunately I can't manage to get more than what I show here in the image. As you might be able to see it is the contours of black and white areas where the black areas are a bit black noise and white is clear.

Does anyone have some suggestings to improve my register settings the right way to get a more black and white image?

Currently, I take d7 and when its value is 1 (>= 128) then I assume white. Black otherwise.

{0x11, 0x06}, // CLKRC (prescaler set to 0x06 per your request)
    {0x12, 0x00}, // COM7: Select YUV
    {0x15, 0x20}, // COM10: per your request (PCLK polarity rising)
    {0x8C, 0x00}, // RGB444 disable
    {0x40, 0x10}, // COM15: Full range output, YUV422
    {0x3A, 0x00}, // TSLB: YUYV order
    {0x32, 0x80}, // HREF control
    {0x17, 0x16}, // HSTART
    {0x18, 0x04}, // HSTOP
    {0x19, 0x02}, // VSTART
    {0x1A, 0x7A}, // VSTOP
    {0x03, 0x0A}, // VREF
    {0x0C, 0x00}, // COM3: No scaling, no DCW
    {0x3E, 0x00}, // COM14: No scaling, normal PCLK
    {0x70, 0x3A}, // Scaling Xsc
    {0x71, 0x35}, // Scaling Ysc
    {0x72, 0x11}, // Scaling DCWCTR
    {0x73, 0xF0}, // Scaling PCLK divider
    {0xA2, 0x02}, // PCLK delay
    // 
    {0x4F, 0x80}, 
    {0x50, 0x80}, 
    {0x51, 0x00}, 
    {0x52, 0x22}, 
    {0x53, 0x5E}, 
    {0x54, 0x80}, 
    {0x55, 0x00}, //    BRIGHTNESS (default 0x00)
    {0x56, 0x40}, //    Contrast (default 0x40)

Ok, with some help I got it working kind of very well looking like this:

Improvements that were suggested on stackoverflow by "brandon":
{0x40, 0x00}, // COM15: Full range output, YUV422
{0x3A, 0x04}, // TSLB: YUYV order

Now I still have vertical lines which I'd like to take care of. any suggestions?