Skip to content

This repository contains the source code for a visual object tracking project, designed to detect and track a specific object using a combination of computer vision and a physical 6 DOF robotic system.

License

Notifications You must be signed in to change notification settings

aarshon/visual-object-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visual Object Tracker

This repository contains the source code for a visual object tracking project, designed to detect and track a specific object using a combination of computer vision and a physical 6 DOF robotic system.

The project is split into two main components:

  1. Vision System (Python): Handles object detection, tracking logic, and communication with the microcontroller.
  2. Robotic Control (c): Manages the motor contrl based on commands received from the vision system.

Project Structure

  • The main Python script that uses OpenCV for video capture and image processing. It implements a PID controller to determine the motor speed and direction required to keep the target object centered. It communicates with the microcontroller over a serial port.
  • The C code for a microcontroller (e.g., a PSoC or Arduino-based system). This code receives serial commands and translates them into PWM signals to drive a motor. It also provides feedback on an LCD display.
  • An alternative or supplementary Python script that demonstrates object detection using a pre-trained deep learning model (MobileNet-SSD). This could be used for more advanced object tracking.

Getting Started

Prerequisites

  1. Python 3.x
  2. OpenCV(cv2)
  3. NumPy (cumpy)
  4. PySerial (pyserial)
  5. A microcontroller with C compiler
  6. A motor driver and a motor
  7. A LCD Display (Optional)

How it works

  1. The Python script captures video frames from the webcam.
  2. It converts the frame to the HSV color space, which is better for color-based detection.
  3. A color mask is applied to isolate the red object.
  4. The script calculates the center of the detected object's contour.
  5. A PID controller algorithm uses the object's position relative to the center of the frame to calculate a control signal.
  6. This control signal is translated into a motor speed and direction.
  7. The speed and direction are sent as two bytes over the serial port to the microcontroller.
  8. The C code on the microcontroller receives these two bytes.
  9. Based on the received values, the C code adjusts the PWM duty cycle for the motor driver to turn the motor at the specified speed and direction.
  10. This creates a feedback loop, continuously adjusting the motor to keep the red object centered in the camera's view.

License

This project is license under the MIT License - see the LICENSE file for details.

About

This repository contains the source code for a visual object tracking project, designed to detect and track a specific object using a combination of computer vision and a physical 6 DOF robotic system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published