首页 > > 详细

调试C/C++语言、C/C++语言调试、Video Monitoring编程解析

24/11/2017 COMP2011 Assignment 3: Video Monitoring
Assignment 3: Video
Monitoring
MENU
Introduction
Description
Implementation and
Marking
Submission and deadline
FAQ
INPUT VIDEO
The video is a text file that stores the number of frames and each frame's data. Each frame. (9 rows, 30 column)
presents a one­way street with four lanes with width of 1 row. In each frame, the fence between two lanes is
represented by the character '­', and the ground is '>' and vehicle is '*'. An example frame. data with two vehicles is
shown below. In this frame, the first vehicle is in the first lane while the second vehicle is in the third lane.
  ------------------------------
 
  >>>>>*>>>>>>>>>>>>>>>>>>>>>>>>
 
  ------------------------------
 
  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
  ------------------------------
 
  *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
  ------------------------------
 
  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
  ------------------------------
 
In this assignment the image coordinate (row, column) is used to describe the position of each pixel, and rows are
counted from zero from top to bottom, while columns are counted from zero from left to right. For example, the first
vehicle in the above frame. is in position (1, 5). Also, to simplify the monitoring task, in this assignment we assume
that:
Each given video will have successive frames indexed from zero. The frame. index will not jump (e.g.,
frame. 3 must be followed by frame. 4 or eof).
Each vehicle will drive from left to right within its lane.
The distance between two different vehicles on the same lane must be greater than 8 (MAX_SPEED).
The distance between one vehicle in two successive frames, namely the vehicle speed, should be at least 1
and at most 8 (MAX_SPEED). Speed is measured in number of columns per frame.
New vehicles entering into a lane always show up in the first column of the lane, with an initial speed of 1.
STRUCTURES
Four structures are used in this project: Video, Frame, Vehicle and VehicleFrameInfo. The four structures are
described briefly below. For detailed definitions of these structures, please refer to the provided structure.h file.
Video is a structure holding all video information, including the total number of frames (num_frames), the number
of frames in the frame. list (num_processed_frames), and the processed vehicle number (num_vehicles). It also
contains the pointer to all image data (raw_data), the pointer to the first frame. (first_frame) and an array of
pointers to all vehicles (vehicles). Note that all frames in this video is chained up by a link list structure.
Frame. is a structure describing one video frame, including the frame. index (index), frame. data (image), number of
vehicles in this frame. (num_vehicles), the array of pointers to all vehicles in this frame. (vehicles), and the pointer to
the next frame. (next_frame) in the link list structure.
Vehicle is a structure describing one vehicle, including the vehicle's appearance order in the video (index), the next
appeared vehicle (next_vehicle), the number of frames this vehicle shows in (num_visible_frames), and its
information in all visible frames which is chained by a link list structure (first_frame_info).
VehicleFrameInfo is a structure describing the information of one vehicle in one visible frame, including the index
of the vehicle (vehicle_index), the index of the frame. (frame_index), the row and column coordinates (position), and
the speed of the vehicle (speed). For one vehicle, its information in all frames are chained by a link list structure
(next_frame_info).
The following figure shows the connections between the four structures. The "VF_info" indicates the
VehicleFrameInfo structure. The 1D array pointed by Video represents the Video.vehicle in Video structure, and the
1D array pointed by each frame. represents the vehicles in Frame. structure. Also in these 1D arrays, "v
i
" represents
the pointer to Vehicle i, "n" the nullptr, "..." the remaining nullptr pointers. Please study this figure together with the
structure.h file before starting your implementation. Mis­handling the pointers in these structures will result in
segmentation faults in your program.
Web view Printable viewCourse homepage ++ Font size‐‐ Font size
COMP2011
Introduction to Object­oriented Programming
24/11/2017 COMP2011 Assignment 3: Video Monitoring
https://course.cse.ust.hk/comp2011/assignments/PA3/# 2/3
WORK­FLOW
The main.cpp file provides a program for processing the video in a frame­by­frame. manner. We have provided the
input/output interfaces in the main.cpp and the program will read the video, process each frame, output the video
information and clean up all memories allocated. To process each frame, the program will do the following:
Initialize a new frame. in the video.
Track all vehicles in the previous frame. and the new frame. (if the new frame. is not the first frame)
Update information (of vehicles from the previous frame) in the new frame.
Detect new vehicles in the new frame. and add them and their information to the video.
Please study the work­flow of the program before starting your implementation. You can test the corresponding
windows executable with the input video by putting them in the same folder. The print out in the console should be:
Reading video file. Totally 5 frames. Finished.
Frame. 0 info:
vehicle 0 in coordinate (1, 0) with speed of 1
vehicle 1 in coordinate (5, 0) with speed of 1
Frame. 1 info:
vehicle 0 in coordinate (1, 3) with speed of 3
vehicle 1 in coordinate (5, 8) with speed of 8
vehicle 2 in coordinate (3, 0) with speed of 1
vehicle 3 in coordinate (7, 0) with speed of 1
Frame. 2 info:
vehicle 0 in coordinate (1, 7) with speed of 4
vehicle 1 in coordinate (5, 16) with speed of 8
vehicle 2 in coordinate (3, 4) with speed of 4
vehicle 3 in coordinate (7, 3) with speed of 3
vehicle 4 in coordinate (5, 0) with speed of 1
Frame. 3 info:
vehicle 0 in coordinate (1, 12) with speed of 5
vehicle 1 in coordinate (5, 24) with speed of 8
vehicle 2 in coordinate (3, 8) with speed of 4
vehicle 3 in coordinate (7, 6) with speed of 3
vehicle 4 in coordinate (5, 1) with speed of 1
Frame. 4 info:
vehicle 0 in coordinate (1, 16) with speed of 4
vehicle 2 in coordinate (3, 13) with speed of 5
vehicle 3 in coordinate (7, 9) with speed of 3
vehicle 4 in coordinate (5, 2) with speed of 1
vehicle 5 in coordinate (1, 0) with speed of 1
Vehicle 0 info:
in frame. 0 in (1, 0) with speed of 1
in frame. 1 in (1, 3) with speed of 3
in frame. 2 in (1, 7) with speed of 4
in frame. 3 in (1, 12) with speed of 5
in frame. 4 in (1, 16) with speed of 4
Vehicle 1 info:
in frame. 0 in (5, 0) with speed of 1
in frame. 1 in (5, 8) with speed of 8
in frame. 2 in (5, 16) with speed of 8
in frame. 3 in (5, 24) with speed of 8
Vehicle 2 info:
in frame. 1 in (3, 0) with speed of 1
in frame. 2 in (3, 4) with speed of 4
in frame. 3 in (3, 8) with speed of 4
in frame. 4 in (3, 13) with speed of 5
Vehicle 3 info:
in frame. 1 in (7, 0) with speed of 1
in frame. 2 in (7, 3) with speed of 3
in frame. 3 in (7, 6) with speed of 3
24/11/2017 COMP2011 Assignment 3: Video Monitoring
https://course.cse.ust.hk/comp2011/assignments/PA3/# 3/3
in frame. 4 in (7, 9) with speed of 3
Vehicle 4 info:
in frame. 2 in (5, 0) with speed of 1
in frame. 3 in (5, 1) with speed of 1
in frame. 4 in (5, 2) with speed of 1
Vehicle 5 info:
in frame. 4 in (1, 0) with speed of 1
The average speed of this road: 3.33333
Page maintained by Yao Yao   |    Course homepage

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!