Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
zhliu 46bfd6b89c
Update to 1.0.2 release
3 years ago
..
46bfd6b89c
Update to 1.0.2 release
3 years ago
46bfd6b89c
Update to 1.0.2 release
3 years ago

README

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  1. ################################################################################
  2. # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a
  5. # copy of this software and associated documentation files (the "Software"),
  6. # to deal in the Software without restriction, including without limitation
  7. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. # and/or sell copies of the Software, and to permit persons to whom the
  9. # Software is furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. # DEALINGS IN THE SOFTWARE.
  21. ################################################################################
  22. Prerequisites:
  23. - DeepStreamSDK 5.1
  24. - Python 3
  25. - Gst-python
  26. - NumPy package
  27. - OpenCV package
  28. To install required packages:
  29. $ sudo apt update
  30. $ sudo apt install python3 python3-opencv python3-numpy python3-gst-1.0 -y
  31. To run:
  32. $ python3 deepstream-opticalflow.py <uri1> [uri2] ... [uriN] <output_folder>
  33. e.g.
  34. $ python3 deepstream-opticalflow.py file:///opt/nvidia/deepstream/deepstream-5.1/samples/streams/sample_720p.mp4 output
  35. This document shall describe about the sample deepstream-nvof-app application.
  36. Optical Flow (nvof gstreamer plugin):
  37. NVIDIA GPUs, starting with the Nvidia GPU Turing generation and Jetson Xavier generation,
  38. contain a hardware accelerator for computing optical flow. Optical flow vectors are
  39. useful in various use cases such as object detection and tracking, video frame rate
  40. up-conversion, depth estimation, stitching, and so on.
  41. The gst-nvof plugin collects a pair of NV12 images and passes it to the low-level
  42. optical flow library. The low-level library returns a map of flow vectors between
  43. the two frames as its output. The map of flow vectors is encapsulated in an
  44. NvOpticalFlowMeta structure and is added as a user meta for each frame in the batch
  45. using nvds_add_user_meta_to_frame() function.
  46. Optical Flow Visualization (nvofvisual gstreamer plugin):
  47. The Gst-nvofvisual plugin is useful for visualizing motion vector data.
  48. The visualization method is simmilar to the OpenCV reference source code in:
  49. https://github.com/opencv/opencv/blob/master/samples/gpu/optical_flow.cpp
  50. The plugin solves the optical flow problem by computing the magnitude and direction of
  51. optical flow from a two-channel array of flow vectors.
  52. It then visualizes the angle (direction) of flow by hue and the distance (magnitude) of
  53. flow by value of Hue Saturation Value (HSV) color representation.
  54. The strength of HSV is always set to a maximum of 255 for optimal visibility.
  55. This sample creates instance of "nvof" & "nvofvisual" gstreamer elements.
  56. 1) nvof element generates the MV (motion vector) data and attaches as
  57. user-meta data.
  58. 2) nvofvisual element is used for visualizing the MV data using pre-defined
  59. color wheel matrix.
  60. 3) It then obtains the flow vectors and demonstrates visualization of these
  61. flow vectors using OpenCV. The obtained image is different from the visualization
  62. plugin output in color, in order to demonstrate the difference.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...