Details | |
---|---|
Target OS: | Ubuntu* 16.04 LTS |
Programming Language | C++ |
Time to complete: | 30 min |
This reference implementation takes a video input (webcam/loaded video), generates a visual heatmap / motion map, counts the number of people present and integrates the results. The application has the functionality of creating an output video and saving a snapshot at a particular instance by the user to the cloud.
The opencv functions calculate the total number of frames, frame width, frame height and frames per second (fps) of the video input (camera or file). Video object files are saved. Threshold and add weights outputs are fed to these video object files to generate a heatmap. The solution detects and draws people, adjusts boundary boxes, and returns the count using the Inference Engine included in OpenVINO™ toolkit.
- TANK AIoT Developer Kit
- *UVC compliant USB camera
- Ubuntu* 16.04
- Intel® System Studio
- OpenVINO™ toolkit
- Node.js* environment with “yargs, path, azure-storage” installed
Note: Please go through the code and specify the required paths in the comments before executing.
- Open Intel® System Studio.
- Click File→ New→ Project→ Application Development→ C/C++ project to build and run on this Linux operating system.
- Click the Intel® Compiler under Examples and click the ICC example.
- Clear the entire code present in .cpp file and write your code to be executed.
- Make the required changes to ensure you are error free.
To link the libraries to the Project perform the following.
- Click on Project→ Properties→ C/C++ Build→ Settings.
- Select the libraries under Intel C++ linker.
- Add the required libraries and path for the libraries as shown below.
- Click Apply.
- Then click OK.
To include the required header files for the project, perform the following:
- Click Project→ Properities→ C/C++ General→ Paths and Symbols.
- Click Add. This adds the required paths as shown below.
To build the project, perform the following:
- Click Project→ Build Project.
- Binaries will be created as shown below, if there are no errors.
This project uses an Azure account with storage containers present in it. For guidance, follow the official documentation by Microsoft* on setting it up.
Note: Make sure you've plugged in a UVC webcam before attempting to run the application
To verify whether this is working properly or not, perform the following.
- Click Run→ Run As→ Local Application.
- As per the specified duration in the code, the images are uploaded to the cloud.
-
Input to the code
The input to the code can be a video file or the camera.
-
Calculation of frame requirements
Calculation of the total number of frames, frame width, frame height and frames per second (fps) using opencv functions.
-
Saving video APIs
Videos are saved on the same path unless otherwise specified.
Three object files-generate three video files.
-
Heatmap Generation
background segmentor : intel cvsdk supports Mog2
Threshold and add weights outputs are fed to video object files (APIs ‘addWeighted’ , **** ‘threshold’)
-
People Count The copy of the original frame is sent into the setup function which uses HOGDescriptor.
Detect and draw function predicts the people, adjusts the boundary boxes and returns the count.
-
Uploading Depending on the user requirement, change the number accordingly for the time difference delay the snaps have to be uploaded to the cloud.
frame count=total number of frames frame= count generated for the requested snap to occur
-
The upload.sh system call is initiated where the particular output frame goes through node.js script and the output frame gets uploaded to the cloud.
-
A complete heatmap is set as an overlay on the first frame of the video for understanding the footfall in that entire video.