Video Data Collection How-to
This page provides a non-exhaustive list of the steps to collect video data for various transport studies, eg road safety based on surrogate measures of safety and road user behaviour analysis.
The list of equipment is available on the Equipment page.
Sommaire
Certification éthique / Ethics Certification
Ethics approval must be obtained (completely, not conditionally) from the ethics committee of Polytechnique.
Si besoin, un document de confidentialité à signer est disponible ici.
If needed, the confidentiality agreement to sign is available here.
Site Selection and Choice of Camera Position
The site should be selected depending on the study objectives and practical consideration to install the camera(s).
Permission has to be asked before putting the cameras. We usually try to get in touch with the responsible person (eg a traffic engineer at the borough/city), but in Montreal, an online form can also be used for temporary requests (https://montreal.ca/demarches/obtenir-un-permis-doccupation-temporaire-du-domaine-public-pour-travaux).
Cameras should be as high as possible to avoid occlusion between road users, and provide the right field of view to capture video about the phenomena of interest. There are two possible ways to install cameras, either on one of the telescopic poles available at Polytechnique that must be attached to existing fixed infrastructure, for example a lamp post, or on existing infrastructure, for example on a balcony or the roof of a building. The first way is described in details below, depending on the type of camera (visible light or infrared).
Another point to take into account when choosing the field of view: one needs to be able to calibrate the camera, ie project the position in the image space to position in real world coordinates. This is done through the identification of at least 4 points (more is better, eg 6-8) that encompass the area of study (ie of which convex hull contains most of the trajectories of the road users that will be analyzed). The calibration is done through a script in the Traffic Intelligence project.
One must takes notes of the camera setup in the field, with at least the following information for each site and installation:
- camera type (and other settings, eg field of view, framerate)
- recording start time
- visible points used for calibration
Data Collection with a Regular Camera (visible spectrum), eg Gopro
The steps can be seen in the following videos (photos for the steps 2 to 12). Beforehand, one needs to:
- charge the batteries;
- make sure the memory cards are empty (the files have been stored on one of the computers at Polytechnique.
The list of equipement is: a camera, a battery pack, a telescopic mast, duct tape, 2 strings of rope, a strap with ratchet buckle, chains and a lock.
- Check that you have the adequate equipment for collecting the data that you need
- Note: One battery pack of 10 000 mA.h allows the camera to record a video for a duration of about 17h, which is equivalent to about 128Gb worth of data, depending on the video resolution (maximum capacity of the GoPro). Check the battery levels of the devices before setting up the camera.
- Unscrew and extend the first level of the mast.
- Tie the battery pack (USB power bank) to the mast with tape (see picture #2).
- Attach the GoPro camera at the top of the mast (see picture #3) and connect the GoPro to the battery pack (see picture #4).
- Note #1: in case of rain, make sure to put a piece of tape on top and on the back of the GoPro, to protect the camera.
- Note #2: Turn the rope around the mast to stabilize it, eg in case of wind.
- Warning: add plastic and tape to waterproof the camera if rain is scheduled.
- Turn on the GoPro by holding the front button for a few seconds. A blue light means that the GoPro is connected to internet. Use Quick: Video Editor (official GoPro app) on your smartphone to connect your phone to the camera.
- Tie the rope around the base of the GoPro and tighten (see picture #5).
- Put the mast along the pole, eg a lamppost, from where you want to make your observations from (see picture #6). There should be two separate strings of rope going from the GoPro to the ground.
- Take the retaining strap and open the ratchet buckle (see picture #7). Wrap the strap go around the pole and the mast. Put the strap into the opening in the middle (see picture #8). Fasten the strap to the pole by cranking the buckle (see picture #9).
- Tip: Do not tighten the strap (ratchet buckle) all the way for now.
- Unscrew and extend the remaining levels of the mast until the camera reaches the required height.
- Tip: Use the app on your phone to see the view of the camera and rotate horizontally to adjust the view. To adjust the camera angle, you need to bring it back down and manually rotate the GoPro.
- Two people need to each take one string of the rope, which is tied to the GoPro, and turn around the pole in opposite directions (one clockwise and the other counterclockwise). This will allow for the mast to be tied up to the pole and not move during the recording (see picture #10).
- Pass the strings between the strap and the pole (see picture #11). Crank the buckle to tighten the strap.
- Lock the mast as attached to the pole with the lock and chain (see picture #12).
Data Collection with a Thermal Camera
The steps can be seen in the following videos (photos 2 to 15). Beforehand, one needs to:
- charge the batteries;
- make sure the memory cards are empty (the files have been stored on one of the computers at Polytechnique.
The list of equipement is: the camera, a battery pack, a telescopic mast, duct tape, 2 strings of rope, a strap with ratchet buckle, chains, a lock, the Rasberry Pi and 2 batteries in an enclosure.
- Check that you have the adequate equipment for collecting the data that you need.
- Note 1: The mast is different from the one used to set up the GoPro because this one is heavy enough to support the camera.
- Note 2: You need a 20 000 mA.h battery pack to record 24 hours with the Raspberry Pi.
- Check the battery levels of the devices before setting up the camera.
- Attach the thermal camera at the top of the mast (see picture #2)
- Tip: To adjust the angle of the camera, you will need a screwdriver and pliers.
- Tie the rope around the base of the thermal camera and tighten.
- Put the mast along the pole where you want to make your observations from (see picture #3). There should be 2 separate strings of rope going from the thermal camera to the ground.
- Take the retaining strap and open the ratchet buckle (see picture #4). Have the strap go around the pole and the mast. Put the strap into the opening in the middle (see picture #5). Tie the strap to the pole by cranking the buckle (see picture #6).
- Tip: Do not tighten the ratchet buckle all the way for now.
- Unscrew the remaining levels of the mast until the camera reaches the required height.
- Open the box connected to the thermal camera and sort the cables according to the picture bellow (see picture #7)
- Put the two batteries in the box and put them in serie using the connector (see picture #8).
- Connect the two wires to the batteries (see picture #9). The extremity of one of the wire is colored black because that wire needs to be connected to the black end on the battery.
- Note: We will need to colour the tip regularly because it fades away.
- Once ready, press the On sign on the switch (line) (see picture #10)
- Connect the ethernet port and the battery pack to the Rasberry Pi (see picture #11).
- Tip: The LEDs on the Rasberry Pi shoud be flahing. This signifies that the device is exchanging data with the camera.
- Wait 5 minutes to check the recording of the Rasberry Pi and adjust the camera if needed. This might require multiple attempts since there are no way to check the recording in real time.
- Note: There are 2 ways to check the recording. One, connect the ethernet port with a computer and open a navigator to see the recording of the IP adress. Second, connect to the rasberry pi 5 minutes after the start of the recording.
- Two people need to each take one string of the rope, which is tied to the GoPro, and turn around the pole in opposite directions (one clockwise and the other counterclockwise). This will allow for the mast to be tied up to the pole and be static during the recording (see picture #12).
- Place the stings between the strap and the pole (see picture #13). Crank the ratchet buckle to tighten the strap.
- Lock the mast to the pole with the lock and chain (see picture #14).
- Put the Rasberry Pi and the battery pack in the box and lock it (see picture #15).
- After recording, disconnect the camera first (Off button), then the Rasberry Pi.
- Note: By turning off the camera, you will lose the last 20 minutes of recording. Make sure to film an extra 20 minutes to have the appropriate amount of recording.
Starting the recording
There are several other crucial elements to check in setting the pole and camera:
- the position of the camera and its field of view (what is seen in the camera view): the camera should be as high as possible to minimize occlusions
- the camera settings, in particular
- wide field of view
- resolution (not changeable easily for thermal camera)
- date and time
Ask Nicolas Saunier or the responsible graduate student if you are not sure. Please verify these things more than once. If poor data is collected, it may be useless.
Don't forget to start the recording.
Health and Safety Management
Types of risks (probability and consequence of events):
- risk of crash
- risk of hurting oneself during equipment installation and removal
Data Management
The folder structure to store the video data files should follow something similar to: videos/[site]/[yyyy-mm-dd]/ contains all the videos collected at site [site] on day [yyyy-mm-dd]. Please avoid space and accented characters in the files and directory names. Here is an example:
Data ├── <Site 1> │ ├── <Date 1> │ │ ├── <Video 1> │ │ ├── <Database 1>.sqlite │ │ ├── <Video 2> │ │ ├── <Database 2>.sqlite │ │ │ . │ │ │ . │ │ │ . │ │ ├── homography.txt │ │ ├── frame.png │ │ ├── mask.png │ │ └── point-correspondences.txt │ ├── <Date 2> │ └── <Date 3> │ . │ . │ . └── <Site 2> . .
With several sites, one should consider the metadata Python module in Traffic Intelligence to store the data. There are several objects to create corresponding to the essential elements of the collected data and for analysis: site (with a corresponding world image), camera view (for each camera and camera installation, with corresponding camera parameters (intrinsic and distortion), mask and homography) and video sequences (for each video file, with a corresponding database of extracted trajectories).
Other unstructured important information (camera location, particular conditions (roadwork) and site observations) can be manually written in a text file usually called 'info.txt' with the video files.