Built to order

Abandoned Luggage Detection using OpenCV

This project builds a classical computer-vision security system with no neural networks: OpenCV's MOG2 background subtraction learns the scene from CCTV-style footage, and any foreground object that stays stationary beyond a configurable dwell threshold (default ~30 s) is flagged as potentially abandoned luggage, with elapsed-time labels and an alarm overlay. The Flask demo visualizes the foreground mask side-by-side so every detection is explainable. An included evaluation procedure measures detection rate vs false alarms on sample test clips — no pre-claimed scores.

CCTV-style footage still for the abandoned luggage detection project: an airport concourse frame with a stationary bag highlighted by an alarm-colored box and an elapsed-time label.
More project photos (2)

The problem

Unattended bags in airports, stations and malls are a genuine security concern — and the instinct of most student builds is to reach for deep learning first, even though a simpler, fully explainable classical pipeline handles the core of the problem. Detecting potentially abandoned luggage should not require GPU hardware, annotated training data or a black-box model, yet most published student approaches assume all three. The heart of the task is change detection: something appeared in the scene and stopped moving. OpenCV's MOG2 background-subtraction algorithm learns a per-pixel model of the background from the video itself, extracts foreground blobs from each frame, and flags any object that stays still beyond a configurable dwell threshold. With no neural network anywhere in the pipeline, every detection traces back to a concrete step — foreground mask, contour, timer — which makes the system fast on CPU, training-free and unusually clean to defend in a viva.

Frequently asked questions

  1. Why is there no deep learning in this project? Abandoned-object detection is fundamentally a change-detection problem: something appeared and stopped moving. MOG2 background subtraction solves that directly, runs on CPU, needs no training data, and every detection is explainable — a clean, defensible engineering choice.
  2. How does MOG2 background subtraction work? Each pixel is modeled as a mixture of Gaussians representing its recent history; pixels that stop matching the background model are marked foreground. The model adapts slowly over time, so gradual lighting changes are absorbed while new objects pop out.
  3. What is the dwell threshold and can it be changed? It is the number of seconds an object must stay stationary before the alarm triggers — ~30 s by default. It lives in a single settings file, so the sensitivity tradeoff can be demonstrated live.
  4. How is the system evaluated? There is no trained model to score. The included evaluation procedure runs the pipeline on sample test clips (such as the PETS 2006 abandoned-baggage scenario) and records detection rate against false alarms — the report documents the procedure and how to interpret the results.
  5. Is this project suitable for a final-year project? Yes. It suits B.E./B.Tech students in Computer Science, AI/ML and Electronics, demonstrating background subtraction, morphological filtering, contour tracking and honest failure-mode analysis — with a viva defence that is unusually easy to explain.
  6. What will I receive? Complete source code, the configuration file, reference pointers to the PETS 2006 test scenario, the evaluation procedure document, project report PDF, PPT presentation, viva Q&A document and a setup guide.

How it works

Dataset & model:
Dataset: none — this is a classical computer-vision pipeline with no training phase and no neural network.
Reference test setup: the PETS 2006 abandoned-baggage scenario, the standard academic benchmark setup for this task (reference pointers included).
Method: MOG2 background subtraction (Zivkovic), morphological cleanup, contour extraction, centroid tracking with a per-object dwell timer.
Input: CCTV-style video files (or camera input), processed frame by frame on CPU.
Prediction: stationary foreground objects whose dwell time crosses the configured threshold (default ~30 s).
Output: annotated video stream with boxes, elapsed-time labels and alarm overlays, plus the live foreground-mask visualization.
Evaluation: detection rate vs false alarms measured by the buyer using the included evaluation procedure on sample test clips — no pre-claimed scores and no trained weights.
Note: the pipeline detects stationary objects, not luggage specifically — a person standing still is flagged the same as a bag; distinguishing luggage from people would need a classifier on top (documented as a possible extension).

Working:

  1. Video frames are fed to OpenCV's MOG2 background subtractor, which maintains a per-pixel Gaussian mixture model of the scene learned from the footage itself.
  2. The raw foreground mask is cleaned with morphological opening and closing to remove speckle noise.
  3. Contours are extracted from the cleaned mask and filtered by minimum area to drop tiny, irrelevant blobs.
  4. Blob centroids are tracked across frames; a blob that barely moves accumulates dwell time second by second.
  5. When dwell time crosses the configured threshold (default ~30 s), the object is flagged with an alarm-colored box and an elapsed-time label.
  6. The Flask demo streams the annotated video next to the live foreground mask, so reviewers see exactly why each object was flagged.
  7. The included evaluation procedure (detection rate vs false alarms on sample test clips) is run by the buyer, not pre-claimed — there is no trained model to score.

Specifications:
Method | Classical computer vision — no neural network, no training data needed
Algorithm | MOG2 background subtraction (Zivkovic), morphological cleanup, contour tracking
Dwell threshold | ~30 s default, configurable in the settings file
Input | CCTV-style video files; stationary objects get boxes, timers and alarm overlays
Output | Annotated video stream plus live foreground-mask visualization
Evaluation | Included procedure: run the pipeline on sample test clips and record detection rate vs false alarms — no pre-claimed scores
Demo app | Flask web app with upload and side-by-side mask view

Project features

[MOG2 Background Subtraction] (implemented) — Learns the scene with a per-pixel Gaussian mixture model and extracts foreground blobs, with shadow suppression for cleaner masks.
[Morphological Cleanup] (implemented) — Opening and closing operations remove speckle noise from the raw foreground mask before contour extraction.
[Stationary-Object Tracking] (implemented) — Blob centroids are tracked across frames with a per-object dwell timer that accumulates second by second.
[Configurable Dwell Threshold] (configurable) — The alarm threshold (default ~30 s) lives in a single settings file, so the sensitivity tradeoff can be demonstrated live.
[Alarm Overlay with Timers] (implemented) — Flagged objects get alarm-colored boxes with elapsed-time labels drawn on the annotated video.
[Side-by-Side Mask View] (implemented) — The Flask demo streams the annotated video next to the live foreground mask, making every detection explainable.
[Evaluation Procedure] (implemented) — Documents how to run detection-rate vs false-alarm tests on sample clips; no pre-claimed scores.
[CPU-Only Pipeline] (implemented) — Classical OpenCV throughout: runs comfortably on a regular laptop CPU with no GPU and no training data.

What is included

Complete source code (detection pipeline, tracking, Flask app)
Configuration file for dwell threshold and area filters
Reference pointers to the PETS 2006 abandoned-baggage test scenario
Evaluation procedure document (how to run detection-rate vs false-alarm tests)
Project report PDF (background, MOG2 theory, pipeline design, evaluation procedure, error analysis)
PPT presentation for the final review
Viva Q&A preparation document (background subtraction, morphology, tracking, failure modes)
Setup guide (environment, dependencies, video-file or camera input)

Limitations & prerequisites

Background subtraction reacts to lighting changes, swaying vegetation and camera shake — these create false foreground blobs, documented in the report.
A bag carried through the frame is never flagged; only genuinely stationary objects are.
Dense crowds merge blobs together, so the tracker breaks down in packed scenes.
A person standing still is flagged the same as a bag — the pipeline detects stationary objects, not luggage specifically.
This is an educational prototype, not a certified security system — it must not be used for real surveillance decisions.

Frequently Asked Questions

Why is there no deep learning in this project?

Abandoned-object detection is fundamentally a change-detection problem: something appeared and stopped moving. MOG2 background subtraction solves that directly, runs on CPU, needs no training data, and every detection is explainable — a clean, defensible engineering choice.

How does MOG2 background subtraction work?

Each pixel is modeled as a mixture of Gaussians representing its recent history; pixels that stop matching the background model are marked foreground. The model adapts slowly over time, so gradual lighting changes are absorbed while new objects pop out.

What is the dwell threshold and can it be changed?

It is the number of seconds an object must stay stationary before the alarm triggers — ~30 s by default. It lives in a single settings file, so the sensitivity tradeoff can be demonstrated live.

How is the system evaluated?

There is no trained model to score. The included evaluation procedure runs the pipeline on sample test clips (such as the PETS 2006 abandoned-baggage scenario) and records detection rate against false alarms — the report documents the procedure and how to interpret the results.

Is this project suitable for a final-year project?

Yes. It suits B.E./B.Tech students in Computer Science, AI/ML and Electronics, demonstrating background subtraction, morphological filtering, contour tracking and honest failure-mode analysis — with a viva defence that is unusually easy to explain.

What will I receive?

Complete source code, the configuration file, reference pointers to the PETS 2006 test scenario, the evaluation procedure document, project report PDF, PPT presentation, viva Q&A document and a setup guide.

Components & software requirements

Python 3.10
OpenCV
NumPy
Matplotlib (evaluation plots)
Flask
PETS 2006 abandoned-baggage scenario (reference pointers included; test clips sourced by the buyer)
CPU only — no GPU and no training data needed

Delivery information

Built to order — the source code, configuration, project report, PPT and viva Q&A are prepared fresh for each buyer after the order is placed. The delivery schedule is confirmed at order time, and includes time for pipeline tuning on reference footage and assembling the complete documentation kit.

Support terms
  • Environment and dependency setup guidance, including video-file or camera input setup.
  • Viva preparation support covering background subtraction theory, morphology, tracking and failure modes.
  • Guidance on running the evaluation procedure on the buyer's own test clips.
  • Discussion of feasible customizations before ordering, such as a luggage-vs-person classifier layer (documented as an extension) or alert logging.

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation