Skip to content

Latest commit

 

History

History

Camera

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Camera (OV7670 CMOS image sensor)

(This project is taken over by another project).

Goal

  • Capture QCIF images.
  • Cut out 128 x 128 pixel or 64 x 64 pixel images from QCIF for deep learning

Parts

Test circuit

Schematic

Initialization test

As per the OV7670 datasheet, SCCB slave addresses are:

  • 0x42 for write
  • 0x43 for read

My HiLetgo OV7670 module returned the following ID over SCCB:

  • Product ID: 0x76
  • Version: 0x73

QCIF capture test

I faced a problem that void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi) is called every two HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length) calls.

It took a whole day to determine the cause of the problem. OV7670 seems like outputing 172x144 pixels rather than 176x144.

Showing an image on PC

I have developed an image viewer program in Python to capture an image with the device and to show it on my PC.

                 STM32L4 Discovery
                ...................
                :                 :
 [OV7670]----->[DCMI]        [UASRT]------>[Python program on my PC]
                :                 :
                ...................

I took a picture of myself. It seems like requiring calibraion on its color map.

I figured out the OV7670 register settings to aquire RGB565 color images, and I took a picture of tobacco pipe doll in QCIF format.

Image processing on the device (STM32)

I bought a text book of image processing for college students, and implemented part of the algorithms in the book on STM32.

Cutting out 128x128 from QCIF

Diff between frames

Converting color image to gray scale

Detecting edge by applying DCT and IDCT

References