Vertikale Streifen OV7670, was sind sie und wie können sie sie loswerden?
Posted: 26 Aug 2025, 09:32
Ich habe den OV7670 und ich konfiguriere ihn, um einen Arucomarker in reinem Schwarz / Weiß zu lesen. Ein 1 zeigt Weiß an, ein 0 zeigt schwarz an. Ich möchte diese vertikalen Linien loswerden, um ein schönes und sauberes Bild zu erhalten.static const struct {
uint8_t reg;
uint8_t val;
} ov7670_init_register_values[] = {
{0x11, 0x06}, // CLKRC (prescaler)
{0x12, 0x00}, // COM7: Select YUV
{0x15, 0x20}, // COM10: per your request (PCLK polarity rising)
{0x8C, 0x00}, // RGB444 disable
{0x40, 0x00}, // COM15: Full range output, YUV422
{0x3A, 0x04}, // 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
{0x42, 0x00}, // COM17 = 0x00 (disable test pattern)
{0x73, 0xF0}, // Scaling PCLK divider
{0x4F, 0x80}, // Matrix cf 1
{0x50, 0x80}, // Matrix cf 2
{0x51, 0x00}, // Matrix cf 3
{0x52, 0x22}, // Matrix cf 4
{0x53, 0x5E}, // Matrix cf 5
{0x54, 0x80}, // Matrix cf 6
{0x55, 0x00}, // BRIGHTNESS (default 0x00)
{0x56, 0x40}, // Contrast (default 0x40)
{0xFF, 0xFF}, // END marker
};
< /code>
Erstens übertragen ich einen Reset (0x12, 0x80) mit einer Verzögerung von 10 ms.void capture_image(uint8_t *p_bytes, int *p_byte_counter) {
*p_bytes = 0;
uint8_t bit_counter = 0;
bool odd = true;
uint8_t byte = 0;
unsigned int key = irq_lock(); // Disable interrupts for timing critical section
wait_for_vsync(); // wait until vsync pin is pulled down
while(!get_value(VSYNC_PIN)) {
wait_for_low(PCLK_PIN, true); // wait until PCLK is pulled down or vsync is pulled up
if(get_value(VSYNC_PIN)) break; // cancel if vsync is high
// Read pixel value (1 or 0)
uint8_t pixel = !!(NRF_P0->IN & PIXEL_PIN_7_MASK);
// Branchless odd pixel selection
// pixel contributes only if odd == true (take only Y bytes)
if(odd) {
byte = (byte
uint8_t reg;
uint8_t val;
} ov7670_init_register_values[] = {
{0x11, 0x06}, // CLKRC (prescaler)
{0x12, 0x00}, // COM7: Select YUV
{0x15, 0x20}, // COM10: per your request (PCLK polarity rising)
{0x8C, 0x00}, // RGB444 disable
{0x40, 0x00}, // COM15: Full range output, YUV422
{0x3A, 0x04}, // 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
{0x42, 0x00}, // COM17 = 0x00 (disable test pattern)
{0x73, 0xF0}, // Scaling PCLK divider
{0x4F, 0x80}, // Matrix cf 1
{0x50, 0x80}, // Matrix cf 2
{0x51, 0x00}, // Matrix cf 3
{0x52, 0x22}, // Matrix cf 4
{0x53, 0x5E}, // Matrix cf 5
{0x54, 0x80}, // Matrix cf 6
{0x55, 0x00}, // BRIGHTNESS (default 0x00)
{0x56, 0x40}, // Contrast (default 0x40)
{0xFF, 0xFF}, // END marker
};
< /code>
Erstens übertragen ich einen Reset (0x12, 0x80) mit einer Verzögerung von 10 ms.void capture_image(uint8_t *p_bytes, int *p_byte_counter) {
*p_bytes = 0;
uint8_t bit_counter = 0;
bool odd = true;
uint8_t byte = 0;
unsigned int key = irq_lock(); // Disable interrupts for timing critical section
wait_for_vsync(); // wait until vsync pin is pulled down
while(!get_value(VSYNC_PIN)) {
wait_for_low(PCLK_PIN, true); // wait until PCLK is pulled down or vsync is pulled up
if(get_value(VSYNC_PIN)) break; // cancel if vsync is high
// Read pixel value (1 or 0)
uint8_t pixel = !!(NRF_P0->IN & PIXEL_PIN_7_MASK);
// Branchless odd pixel selection
// pixel contributes only if odd == true (take only Y bytes)
if(odd) {
byte = (byte