Project tutorial
Surveillance Using Tracking

Surveillance Using Tracking © CC BY-NC-SA

It is a Real-time object detection and tracking method in which we use CCTV camera to identify and track the target.

  • 12,685 views
  • 9 comments
  • 37 respects

Components and supplies

Apps and online services

About this project

Object tracking is an important task within the field of computer vision. The proliferation of high powered computers, the availability of high quality and inexpensive video cameras, and the increasing need for automated video analysis has generated a great deal of interest in object tracking algorithms. There are three key steps in video analysis: detection of interesting moving objects, tracking of such objects from frame to frame, and analysis of object tracks to recognize their behavior. Therefore, the use of object tracking is pertinent in the tasks of:

1. Motionbased recognition, that is, human identification based on gait, automatic object

detection, etc.;

2. Automated surveillance, that is, monitoring a scene to detect suspicious activities or

unlikely events;

3. Video indexing, that is, automatic annotation and retrieval of the videos in multimedia

databases;

4. Human computer interaction, that is, gesture recognition, eye gaze tracking for data

input to computers, etc.;

5. Traffic monitoring, that is, real time gathering of traffic statistics to direct traffic flow.

6. Vehicle navigation that is, video based path planning and obstacle avoidance capabilities. In its simplest form, tracking can be defined as the problem of estimating the trajectory of an object in the image plane as it moves around a scene. In other words, a tracker assigns consistent labels to the tracked objects in different frames of a video. Additionally, depending on the tracking domain, a tracker can also provide object centric information, such as orientation, area, or shape of an object.

This project is about real-time object detection and tracking method in which we use CCTV camera to identify and track the target in the viewing range of the camera from surveillance room. Along with software tracking the system will also track the object in the scene using a laser mounted robotic arm. The robotic arm operates in such a way that it covers each and every coordinate in the video frame by its pan-tilt motion.

CAD file link- 

Code

mouse_drag_fina_larduino_workinh_code.inoArduino
This is processing code which transfer the mouse co-ordinates to the arduino and adjust servo according to the mouse pointer position
///////////////////// Processing Code /////////////////////////////////
import processing.serial.*;
import processing.video.*;
import java.awt.*;
import gab.opencv.*;

Capture video;
OpenCV opencv;

Serial Com7; 
float fpan,ftilt;
int pan, tilt, x, y;
int[] inBytes = new int[3];

void setup(){
size(500,500);
String portName = Serial.list()[0];
  Com7 = new Serial(this, portName, 9600);
   video = new Capture(this, 640/2, 480/2);
     opencv = new OpenCV(this, 640/2, 480/2);

     opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
 
//Com7 = new Serial(this, Serial.list()[1], 9600); background(0,0,0);
ellipse(width/2,width/2,10,10);
}

void draw()
{
     scale(2);
       opencv.loadImage(video);
       noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
    image(video, 0, 0 );

  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i < faces.length; i++) {
    println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  }
 pan = int(mouseX*180/width);
tilt = int(mouseY*180/height);
pan = constrain(180 - pan,0,180);
tilt = constrain(tilt,0,180);
Com7.write(pan);
Com7.write(tilt);
Com7.write(255);


while (Com7.available()>0)
{
  


  inBytes[0] = inBytes[1]; 
  inBytes[1] = inBytes[2]; 
inBytes[2] = Com7.read(); 
if(inBytes[2] == 255)
{ 
  println(inBytes[0] +" , " + inBytes[1]); 
//background(0,0,0); 
  //ellipse(width - inBytes[0]*width/180,inBytes[1]*width/180,10,10);
}
} 
}



void captureEvent(Capture c) {
  c.read();
}
facetracking_procesing_final_code.pdeArduino
This code track a persons face in the viewing range
///////////////////// Processing Code /////////////////////////////////
import processing.serial.*;
import processing.video.*;
import java.awt.*;
import gab.opencv.*;

Capture video;
OpenCV opencv;

Serial Com7; 
float fpan,ftilt;
int pan, tilt, x, y;
int[] inBytes = new int[3];

void setup(){
size(500,500);
String portName = Serial.list()[0];
  Com7 = new Serial(this, portName, 9600);
   video = new Capture(this, 640/2, 480/2);
     opencv = new OpenCV(this, 640/2, 480/2);

     opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
 
//Com7 = new Serial(this, Serial.list()[1], 9600); background(0,0,0);
ellipse(width/2,width/2,10,10);
}

void draw()
{
     scale(2);
       opencv.loadImage(video);
       noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
    image(video, 0, 0 );

  Rectangle[] faces = opencv.detect();
  println(faces.length);

  for (int i = 0; i < faces.length; i++) {
    println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  
 pan = int(faces[i].x*180/width);
tilt = int(faces[i].y*180/height);}
pan = constrain(180 - pan,0,180);
tilt = constrain(tilt,0,180);
Com7.write(pan);
Com7.write(tilt);
Com7.write(255);


while (Com7.available()>0)
{
  


  inBytes[0] = inBytes[1]; 
  inBytes[1] = inBytes[2]; 
inBytes[2] = Com7.read(); 
if(inBytes[2] == 255)
{ 
  println(inBytes[0] +" , " + inBytes[1]); 
//background(0,0,0); 
  //ellipse(width - inBytes[0]*width/180,inBytes[1]*width/180,10,10);
}
} 
}



void captureEvent(Capture c) {
  c.read();
}
mouse_drag_fina_larduino_workinh_code.inoArduino
This is arduino code for servo movement
#include <Servo.h> 

byte inBytes[3];

Servo panservo;
Servo tiltservo;

int panangle = 90;
int tiltangle = 90;

void setup(){
Serial.begin(9600);
panservo.attach(9);
tiltservo.attach(11);
}

void loop()
{
if(Serial.available()> 0){
inBytes[0] = inBytes[1];
inBytes[1] = inBytes[2];
inBytes[2] = Serial.read();
if(inBytes[2] == 255)
{ 
  Serial.write(inBytes,3); 
panangle = inBytes[0]; 
tiltangle = inBytes[1];
panservo.write(panangle); 
tiltservo.write(tiltangle);
} 
} 
}
Open CV library for Processing
Install this library for this code to work

Custom parts and enclosures

.stl files

Comments

Similar projects you might like

Smart Face Tracking Robot Car

Project tutorial by Sebastian Hernandez

  • 5,967 views
  • 5 comments
  • 36 respects

Head Tracking for Wireless 3D First Person Vision

Project showcase by twhi2525

  • 8,552 views
  • 7 comments
  • 54 respects

Home surveillance system using skype calls

Project tutorial by Manuel Miguel

  • 1,621 views
  • 0 comments
  • 3 respects

Motion Following Motorized Camera Base

Project tutorial by Lindsay Fox

  • 113,605 views
  • 68 comments
  • 286 respects

GPS Tracking System for Vehicles

Project showcase by Sustainable Living Lab

  • 10,810 views
  • 2 comments
  • 45 respects
Add projectSign up / Login