Camera Tracking System (Camera Vision)

NOTE: If you are interested in purchasing these CTS boards , you can contact me directly using “comments” section.

This page focus on a low-budget solution that implements Colour Segmentation to do real-time tracking of one or multiple objects of a selected colour using a cheap OV7670 camera sensor from ebay and a regular micro-controller, Atmega644P. Initial version was designed and worked well using an Arduino board based on Atmega328P.

Able to track one colour at up to 30 fps, can provide real-time blob details and attached to any existing robotic project using any micro-controller that can communicate over UART port.

Details on how to communicate with the module, sample code on the host side and other information are available bellow.

About CTS module


Some story about this project.

Features

CTS module was design primarily to be able to offer a low power and cheap solution for tracking. Due limited processing speed a Colour Segmentation solution was used to implement tracking. Some of the features of this implementation are:

  • Small size (30 x 30 mm or 50 x 25 mm);
  • Low power consumption;
  • Working with OV7670/OV7725 cameras available cheap on eBay;
  • Some CTS models have on board cameras;
  • Real-time Streaming and Tracking over UART/serial port at very high-speed (up to 921,600 baud);
  • Windows-based client available for GUI setup (free for download, VB source available on request);
  • Simple serial interface to allow command line configuration for all settings;
  • Built-in help for commands when using command line;
  • Configuration can be stored in EEPROM;
  • Standard ISP/JTAG headers available on board for future firmware upgrades.

Some details about tracking:

  • Tracking done in real-time;
  • Up to 8 colour classes can be created for tracking (using YUV format);
  • Virtually can track up to 256 blobs;
  • Fast Tracking mode: up to 30 FPS (1 colour/1 blob);
  • Colour Tracking:  up 8 blobs, 1 blob for each classes of colour defined;
  • Single Colour Tracking: up to 32 non-connected blobs of a selected colour class;
  • Streaming and Tracking can be done simultaneously using one of the following resolutions: 128 x 120, 160 x 120, 256 x 240, 320 x 240;
  • Streaming using YUV422 (2 bytes per pixel), YUV211 (1 byte per pixel) or B&W (4 bits per pixel);
  • Detailed tracking data for each blob is available in ASCII or HEX format (COG, weight, bounding box, etc);
  • Sample code available for AVR, Processing, ARM, etc.

Hardware details

When I started working on this project , I thought of keeping everything within 30 x 30 mm, same size with the OV7670 FIFO camera module, to keep it as compact as possible. Another reason is that most of the pan-and-tilt brackets used for various UAV projects are designed to hold 30 x 30 mm camera module boards. To achieve this, everything on the board is SMD technology, except the connectors, which are through-hole components.

Entire project is designed around ATmega644P and AL422B (3 Mbit FIFO). Data is continuously stored in FIFO chip that can accommodate up to one VGA frame (640 x 480 pixels, 2 bytes per pixel). MCU will retrieve the image from FIFO and process the data line by line.

During initial testing, I decided to use YUV format instead of RGB as seems less affected by light variation and get better results during tracking.

A basic serial terminal is implemented, allowing the board to be configured manually using a simple serial console or through applications running other microcontrollers. A Windows-based client application that help accessing and configuring the module it is also available for download. Details on how to use, set and control together with data format is detailed in Communicating with CTS module section.

There are two versions:

CTS 5.1

30 x 30 mm, no camera on board, can take any OV7670 camera modules from eBay, also available separately, a compact version using OV7670 camera phone module (see pictures).

Standard 6 pin AVR ISP header and FTDI UART header in 0.1″ pitch (for pinout details check here).

Camera Tracking System v0.5.1

CTS 5.2

Measuring only 50 x 25 mm, is same hardware with CTS 5.1 but also come equipped with a OV7670 camera and the electronics required to drive the camera. While keeping the size down due the low profile camera, there is no compromise in image quality.

Also standard 6 pin AVR ISP and FTDI UART headers are available for access.

Camera Tracking System v0.5.2

Both boards will run at 5 Volts.

Pictures with real boards can be seen here.

Specifications

Both AVR modules have the same specs beside the physical differences:

  • MCU: ATmega644P/ATmega1284P;
  • FIFO: AL422B (3 Mbit FIFO);
  • Camera: OV7670/OV7725;
  • UART speeds: 38,400, 57,600, 115,200, 230,400, 460,800, 921,600;
  • Tracking: up to 30 FPS in FastTracking mode (1 colour, 1 blob) or 15 FPS multiple colours/blobs using Colour Segmentation;
  • Streaming: 128 x 120, 160 x 120, 256 x 240, 320 x 240 YUV 422, YUV 211, B&W (4 bit/pixel).

For ARM version, specs are:

  • MCU: LPC1343;
  • EEPROM: 4/8 Kbytes on board;
  • FIFO: AL422B (3 Mbit FIFO);
  • Camera: OV7670/OV7725;
  • UART speeds: 38,400, 57,600, 115,200, 230,400, 460,800, 921,600;
  • Tracking: up to 30 FPS in FastTracking mode (1 colour, 1 blob) or 15 FPS multiple colours/blobs using Colour Segmentation;
  • Streaming: 128 x 120, 160 x 120, 256 x 240, 320 x 240 YUV 422, YUV 211, B&W (4 bit/pixel).

Specs are pretty much the same for both AVR and ARM (LPC1343) boards.

CTS boards

CTS 0.5 boards, from left to right: CTS 0.5.1 with AT644P, CST 0.5.2 with AT1284P and OV7725, CTS 0.5.2 with LPC1343, CTS 0.5.2 with LPC1769 and OV7670.

CTS 7

The new CTS boards (CTS 0.7) are already here and working fine. Are still based on LPC1343 and LPC1769, however, there are lots of changes:

  • Code is smaller and faster;
  • Serial firmware upgrade option;
  • Serial updates for camera’s initial configuration registries;
  • Serial updates for various camera configurations (e.g.: GAMMA, White Balance, contrast, brightness, saturation);
  • Hardware and software to control Pan and Tilt servos in Fast Tracking mode up to 30FPS;
  • Access to servo configuration and control through command line (e.g.:  min/max ranges, positions, etc);
  • PID controller for servos for faster tracking speed (details here);
  • Real-time streaming option up to 30FPS in FastTracking mode;
  • Fine-tuning AWB for OV7670 cameras;
  • Many small changes and fixes.

CTS0.5.2.4(LPC1769) and CTS0.5.2.5(LPC1343) boards

CTS 0.7 boards, with LPC1343 and LPC1769

And a small demo for the new CTS 0.7 (LPC1343) boards:

CTS 0.7 board controlling Pan and Tilt servos @30 FPS and real-time streaming

Communicating with CTS module

How to communicate with CTS module module (connectors pinout, data format, commands to control image or tracking or configure the module, etc.).

Using CTS module with various micro-controllers

Code sample for connecting Camera Tracking System module other platforms or micro-controllers (e.g.: Processing, Propeller, Arduino, AVR, ARM, etc).

198 thoughts on “Camera Tracking System (Camera Vision)

  1. Hello I would like to buy a CTS 0.5.1 with AT644P but can’t find it on Robot R Us can I buy it directly from you? Please contact me

    • Hi Martijn, I am not supporting the ATMEGA models due performance limitations. I do have however the ARM version boards (CTS 0.6 and 0.7). Let me know if you will be interested.

      • Hello Nasulica,

        I’m still interested in your products. Can you send me more information about pricing and how to order them from you?

        Thank you,
        Martijn

  2. Hi I would like to buy cts modules. If you have stocks, could you sell me couple of boards please?

  3. Hello my name is Rodrigo, I am from Mexico, your project is very interesting, could you help me with my project?. I bought a OV7670 camera module and i think the FIFO module is integrated into the camera module, I just want to transmit the video directly to my pc with my OV7670 Camera Module and my Arduino Leonardo Board and really i have no idea how to do it, and so if you were so kind to help me know how to connect the Camera Module to my Leonardo Board and if you could help me with some code please.

    Best regards and sorry for my english

    • Hi Rodrigo! Connecting the camera is easy: choose 8 consecutive IOs to connect to DATA, 2 pins for SCCB, VSYNC as interrupt, OE to GND, the remaining 3 pins: WEN/RRST/RCLK as GPIO.
      For the coding part, did you take a look on the blog? In comments you will find lots of details that may help you started for any MCU (check here, here, here, etc)

  4. hi my name is adrian im from mexico i have module ov7670 but dont have FIFO module. Can i use a SD module for safe the information and send to arduino after??

  5. Hi,
    I have arduino uno, SD shield and ov7670 without fifo and I am trying to capture image and save it on SD card. Can you help me with connections and programming?

    • Hi David, I can help you with the connections. For the programming I can only advise you on how to communicate with the camera to configure it and how to retrieve line by line the frame from the camera module. Most of the information is already available on this blog if you are looking in the comments.
      I do not own an Arduino anymore nor planning to buy one anytime soon…

  6. Hi Nasulica
    I want to know the whole of process projects can be done with microcontroller or part of process you are doing with the computer?
    & Are you running RTX/Os on your MCU?
    Becuse I want follow an object with a VC0706 camera & alone LPC1768 or STM32f103ze MCU .
    Thank you in advance guide :)

  7. could u pls email me the information for cts module? currently i have ov7670 without fifo
    u may advice me for what cts module should i use, and perhaps u can provide me some code too ^_^
    using arduino.

  8. hello could you sent me information about prices for Gts modules
    i want to make a project to recognition plastic bottles will help this module?
    thanx

  9. Hi there,

    I am interested in purchasing your CTS module for a school project. Please contact me via email at your earliest convenience.

    Regards,
    Mark

    • Hi Fungky, can connect to any host using UART. The CTS module will provide tracking details (blob, COG, weight, etc) that your host, Arduino UNO, may use for tracking. You can see an example in the project section (here).

  10. Hi William,

    I have small online Arduino shop in Romania (European Union) and I would like to sell your boards on my store and also implement some projects with them.
    I would like to know the prices for all the versions.

    P.S. Is there a posibility to use only Arduino (Mega, ADK or Due) with a OV7670 camera PCB without the 0.5 board?

    All my best,
    Horia

    • Hi Horia, there are two posts on the blog about how to connect a OV7670 FIFO module to Arduino (hardware and softaware). I will send you details about the boards by mail.

  11. Hello,

    I have application real time iris circle detection and jpeg2000 compression on the selected image. I am supposed to this using ov7725 camera. which one of your board will be suitable for above application? If this application implemented on the low cost hardware than the order will be huge.

    br,
    Abdul

    • Hi Abdul, while you may be able to do a circle detection quite easy, doing a jpeg compression from the output of OV7725 is not something easy. I guess you may need to look either for raw output or to use a jpeg camera instead.
      Btw, i do not sell any module with OV7725 or jpeg camera or dedicated code for circle/iris detection.

  12. hello nasulica, i am working on connection between ov7670 and adruino uno r3. Do you know how to connect them.

    • Hi Tenzin, i posted few entries on how to connect a FiFO version to Arduino. You should be able to connect a non-FIFO board too, but the code will be more complicated.

  13. quisiera por favor si me habilitaran el código , las librerias y circuito para una camara ov7670 vinculado con arduino quisiera ver video y tomar fotos
    lo necesito par ami proyecto agradesco de antemano su gentil respuesta
    mi correo miguelsegurar@gmail.com

  14. Dear nasulika,

    Thanaks for replying.

    ok. i will use 7670. i would configure the camera for 30fps and vga in YUV format and detect a circle in the image. i will right the code for jpeg 2000 compression and send the compressed image via uart to host system.

    Can this be done on any of your board?

    BR,
    Abdul

    • You may be able to detect a circle, however, there is no space to store a full frame on the board. The board is powered by a LPC1343 (@72 Mhz, 8 Kbytes RAM, etc). Also the board will not have enough processing power to handle jpeg compression on the fly. I am afraid that this is not an option…

  15. Hi, I was wondering how I could get info on where you can order the CTS 0.7 or more recent CTS modules you have constructed..

  16. Hello,
    I am interested in purchasing your CTS module. Please, Can you contact me by email?

    Thanks

    Raul

  17. Hi, i like the “CTS 0.7 board controlling Pan and Tilt servos @30 FPS and real-time streaming” demo you have and am interested in playing with one myself. Can you send me some information on how to order the board?

  18. Hi , I’m interested in CTS boards, i have a OV7670 640×480 camera, the aim is to make a flame detection sensor, from what I saw on the page I think is possible, if possible send me prices boards and information, Thank you in advance.

  19. Hello nasulica,

    I have a project where I want a camera. Is it possible that I can get some details of the cameras so I can see if this fits my project and buget?

    Thank you,
    Mark

  20. Hi there,
    I’m impressed with your project! I met Arduino not long ago but very keen to build something with it (or with some similar board). Now I’m just waiting for the idea to come .. Your project is interesting enough to study so I’m wondering if you could tell me more about how to buy it? I don’t have any specific needs – just want to learn and understand it. Can you recommend me a set of things? thanks

  21. Hello, I’m interested in developing my own board, but I can’t find pinouts for OV7670 module that you’ve used in version of CTS 5.2 and higher. Can you please send me link or document including pin descriptions please? Thank you!

  22. Hi, I am Rony from the US. I just started on my hobbyist journey; I’m currently in the leaning (“baby step”) phase. I’m also a student at the Florida International University. I have some question to ask you; one of the questions is, how could I purchase 3 different versions of your board. Please contact me through any one of my emails. Hope to hear from you soon.

  23. Pingback: Video processing in Matlab – Single blob detection | Harris' Electronics

  24. I want to buy only LPC1769 with ov7670 camera, not the whole CTS model. Is it possible? Please I need it and it’s urgent

  25. hi… thanks for that toturial…. and i’am sorry for bad english
    i have a quistion…
    can i do the same project with seperate element…
    i have an ov7670 with fifo AL422 … and i well connect that chip with arduino mega
    can i get the same result with this setup?
    please response to this comment ASAP
    and thank’s very much….

  26. Sir is it possible to interface 7670 camera to arduino mega 2560 R3? if possbile. what are connections and codes needed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s