Fabrication industrielle
Internet des objets industriel | Matériaux industriels | Entretien et réparation d'équipement | Programmation industrielle |
home  MfgRobots >> Fabrication industrielle >  >> Manufacturing Technology >> Processus de fabrication

Surveillance de Précision : Suivi d'Objets avec Arduino et Servomoteurs

Composants et Fournitures

ComposantQuantité
Traitement Arduino (PC/Processing)1
Arduino UNO1
Caméra (générique / CCTV)1
Servomoteurs (Tower Pro MG996R)1

Applications et Services

À propos du projet

Le suivi d'objets est une tâche cruciale en vision par ordinateur. La disponibilité d'ordinateurs puissants, de caméras vidéo de qualité à bas coût, et le besoin croissant d'analyse vidéo automatisée ont suscité un vif intérêt pour les algorithmes de suivi. Trois étapes clés : détection d'objets mobiles intéressants, suivi image par image, analyse des trajectoires pour reconnaître les comportements.

Applications principales :

  1. Reconnaissance par le mouvement : identification humaine par la démarche, détection automatique d'objets
  2. Surveillance automatisée : détection d'activités suspectes ou événements inhabituels
  3. Indexation vidéo : annotation et récupération automatique dans bases multimédias
  4. Interaction homme-machine : reconnaissance gestuelle, suivi du regard pour saisie de données
  5. Surveillance trafic : collecte statistiques temps réel pour régulation flux
  6. Navigation véhicule : planification de parcours vidéo et évitement d'obstacles

Le suivi consiste à estimer la trajectoire d'un objet dans le plan image. Un tracker assigne des étiquettes cohérentes aux objets suivis dans les différentes frames vidéo. Selon le domaine, il peut aussi fournir des informations centrées objet : orientation, surface, forme.

Ce projet implémente une détection et suivi d'objets en temps réel : une caméra CCTV identifie et suit une cible dans son champ de vision depuis une salle de surveillance. En plus du suivi logiciel, un bras robotique motorisé (pan-tilt) avec laser suit physiquement l'objet dans la scène, couvrant chaque coordonnée du cadre vidéo.

Fichier CAO : [lien non fourni]

Code

mouse_drag_final_arduino_working_code.ino (Processing → Arduino)

Code Processing transférant les coordonnées souris vers Arduino et pilotant les servos selon la position du curseur.

///////////////////// 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();
  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]);
    }
  }
}

void captureEvent(Capture c) { c.read(); }

facetracking_processing_final_code.pde (Détection faciale)

Code Processing suivant un visage détecté dans le champ de vision.

///////////////////// 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();
  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]);
    }
  }
}

void captureEvent(Capture c) { c.read(); }

mouse_drag_final_arduino_working_code.ino (Code Arduino pour servos)

#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);
    }
  }
}

Bibliothèque OpenCV pour Processing

Indispensable pour faire fonctionner le code : https://github.com/atduskgreg/opencv-processing

Pièces et Boîtiers Personnalisés

(Section vide dans l'original)

Processus de fabrication

  1. Profilage température Raspberry Pi précis avec Python, SQLite et LabVIEW
  2. Surveillance météo à distance avec Raspberry Pi 3 et PubNub
  3. Intégration du TI SensorTag à Blynk via Node‑RED sur Raspberry Pi Zero
  4. Suivi avancé de balle de ping-pong sur Raspberry Pi avec OpenCV
  5. Contrôler une LED avec un capteur de mouvement PIR sur Raspberry Pi
  6. Suivi d'objets automatisé par vision avec Raspberry Pi et OpenCV
  7. Construire un robot intelligent avec le Bridge Shield – Intégration Raspberry Pi & Arduino
  8. Construire un robot Raspberry Pi piloté Wi-Fi avec Python – Guide pas à pas
  9. Maîtriser les chaînes de caractères en C# : bonnes pratiques et méthodes essentielles