SCIT, University of Wollongong
CSCI435/CSCI935
Computer Vision: Algorithms and Systems
Spring 2020
Assignment Three (25%) Due Date: 5:00pm Sunday 8 November 2020
Objectives
Design a C/C++ or Python program that extracts and counts moving objects, e.g. people, cars and others using background modelling and segmentation of optical flow.
Introduction
Extraction of moving objects from a sequence of images or video is often used in many video analysis tasks. For instance, it is a key component in intelligent video surveillance systems. In this assignment, you are required to develop a program in C/C++ or Python using OpenCV 4.4.0 to detect, separate and count moving objects from a given sequence of images or video captured by a stationary camera. There are three tasks.
Task One (18%) – Background modelling
In this task, you are required to extract moving objects using background modelling. There are three key steps involved in the extracting and counting moving objects:
1. Detecting moving pixels using background modelling and subtraction,
2. Removing noisy detection using morphological operators or majority voting and
3. Count separate moving objects using connected component analysis.
4. Classify each object (or connected component) into person, car and other by simply using the ratio of width and height of the connected components.
OpenCV 4.4.0 provides various algorithms for each of the steps 1 & 2. However, you MAY have to implement your own connected component analysis algorithm and classification algorithm. For simplicity, you can assume that each connected component corresponds to one object.
Original Video Frame
Estimated Background Frame
Detected Moving Pixels before Filtering (in Binary Mask)
Detected Objects (in Original color)
1 of 3
SCIT, University of Wollongong
When running, the program should display the original video frames, estimated background frames, detected moving pixels after the background modeling and subtraction (before any noise removal) and the detected moving objects in a single window as illustrated above. The detected moving pixels before filtering should be displayed in black and white (binary mask). The detected object has to be displayed in its original RGB color (all background pixels should be displayed in black). At the same time, the number of objects or connected components should be output to the command window as illustrated below:
Frame 0001: 0 objects
Frame 0002: 0 objects
…
Frame 0031: 5 objects (2 persons, 1 car and 2 others)
Frame 0032: 6 objects (3 persons, 1 cars and 2 others)
…
Frame 1000: 10 objects (
…
Task Three (7%) – Segmentation of moving objects
In this task, you are required to extract moving objects using segmentation of motion fields (e.g. optical flows). You need to design your own solution by using the algorithms you have learned from the subject. The solution must be described in the head of your source C/C++ or Python code.
Original Video Frame One
Original Video Frame Two
Estimated Motion Field
Segmented
O bjects
(In Original color)
The program should display the original video frames, estimated motion field, detected moving pixels and the detected moving objects in a single window as illustrated above. The two original video frames are those from which the motion field is estimated. The estimated motion field should be displayed using “arrow” whose direction encodes motion direction and length encodes magnitude of the motion. Note that you may choose to display motion flow of every other 2, 3 or 4 pixels so as not to clutter the display. The segmented object has to be displayed in its original RGB color (all background pixels should be displayed in black). At the same time, the number of objects or connected components should be output to the command window in the same format as that of Task One.
Requirements on coding
1. The program should be named as “movingObj” and shall take an option, either –b or -s and a video filename as the input, e.g. movingObj –b videofile or movingObj –s
2 of 3
SCIT, University of Wollongong
videofile. When –b is given, the program should perform Task One and when –s is given, the program performs Task Two.
2. No other third-party libraries should be used in the program except OpenCV 4.4.0 or OpenCV 4.4.0-Python (assuming that numpy and matplotlib packages exist). The code has to be either in C/C++ or Python.
3. Place your implementation in a single .cpp or .py file called movingObj.cpp or countMovingObj.py
4. Description of the solution to Task Two should be given as comments at the beginning of the movingObj.cppor movingObj.py
5. No other third-party libraries should be used in the program except OpenCV 4.4.0. The code has to be in either C/C++ or python-OpenCV 4.4.0.
Marking Scheme
Zero marks may be graded if your code cannot run or the code does not meet the requirements
Task One
1. Program structure, comments and usability (2%)
2. Read and display of the video frames (2%)
3. Background modeling or estimation (3%)
4. Subtraction and display of the detected moving pixels (3%)
5. Remove of noisy or false detection (2%)
6. Connected component analysis and display of the moving objects (2%)
7. Classification of moving objects (2%)
8. Output number of objects or connected components (2%)
Task Two
9. Description of the solution (1%)
10. Display of the two frames (1%)
11. Estimation and display of motion fields (3%)
12. Segmentation and display of the moving objects (2%)
Submission
Zip the following source and executable files to your_login_name.zip. The zip file must be submitted via Moodle.
For C/C++ implementation: movingObj.cpp, movingObj.exe (Win10, openCV 4.4.0 MS Visual C/C++ 2017 Release version, 64bits)
For Python implementation: movingObj.py (Win10, openCV 4.4.0 + Python 3.8.5)
IMPORTANT:
a) DO NOT include and submit any object files and videos in the zip file. Your submission may not be
accepted if you do so.
b) Submission through email WILL NOT be accepted
3 of 3