This project presents a real-time smart camera tracking system that combines motion-based multiple object tracking with particle filtering for robust object tracking. The system autonomously detects and follows objects using MATLAB for image processing and an Arduino-controlled servo mechanism for real-time camera adjustments.
The system consists of a USB webcam, Arduino UNO, and a pan-tilt servo mount. The webcam captures real-time video, processed in MATLAB to detect objects and compute position errors, which drive servo adjustments.

The development flowchart illustrates the integration of two tracking methodologies:
- Motion-Based Object Tracking (Yellow) – Detects and tracks moving objects in a static scene.
- Particle Filtering (Green) – Enhances robustness by refining object position estimation.
- Hybrid Integration Process (Blue) – Switches to particle filtering after 100 frames of stable tracking.
Object tracking is refined through color histograms, with differences computed using a distance function. The log probability function then determines the object's most probable location. The system continuously updates the camera’s position using a PID-controlled servo mechanism, ensuring seamless tracking.
- Arduino UNO microcontroller
- Pan & Tilt Servo Motors (for camera movement)
- Logitech HD Webcam
- TinkerCad Circuit Simulation
The system integrates motion-based tracking for initial object detection and particle filtering for enhanced accuracy in dynamic scenes.
- Detects objects in a static camera setup
- Segments moving objects using a background model.
- Uses MATLAB's
updateAssignedTracks()function
- Tracks objects when the camera moves
- Uses Bhattacharyya distance for histogram matching
- Updates particle locations dynamically

- Computes position error between the object and frame center.
- Adjusts camera angles to maintain object focus
The system consists of three primary MATLAB scripts:
- Motion-Based Object Tracking –
./MotionBasedMultiObjectTracking.m- Detects objects using background subtraction.
- Particle Filter Tracker –
./particleFilterTracker3.m- Tracks objects dynamically with histogram matching.
- Main Execution Script –
./TESTCODEFINAL.m- Configures Arduino and executes the tracking system.
- Arduino initializes servo motors.
- Motion tracker detects objects and extracts bounding box dimensions and histograms.
- Particle filter refines tracking.
- PID controller adjusts servo angles for object centering.
This project is licensed under the MIT License.
You are free to use, modify, and distribute this project for educational and research purposes, but proper credit must be given to the original author (Noora-Alhajeri).
© 2025 Noora-Alhajeri. All rights reserved.
Originally Developed: December 10, 2022
Uploaded to GitHub: 2025
For questions or collaboration, feel free to reach out:
📧 Email: n.s3eedalhajeri@gmail.com
🌐 LinkedIn: Noora-Alhajeri

