RidgeRun OpenCV Fork: Difference between revisions
Tag: Undo |
|||
Line 18: | Line 18: | ||
=== GStreamer Video Capture === | === GStreamer Video Capture === | ||
Effectively removes the memory copy when transferring data from the GstBuffer to the cv::Mat. Now the GstBuffer and its associated memory will remain alive throughout the lifespan of the matrix. | |||
Tested under the following conditions | Tested under the following conditions | ||
* OpenCV Version: 4.4.0 | * OpenCV Version: 4.4.0 | ||
* FPS and CPU usage taken with the [https://github.com/ridgerun/gst-perf GstPerf] element. | * FPS and CPU usage taken with the [https://github.com/ridgerun/gst-perf GstPerf] element. | ||
* The following | * The following source: | ||
<source lang= | <source lang=c++> | ||
#include <opencv2/opencv.hpp> | |||
int main() { | |||
cv::VideoCapture cap( | |||
"videotestsrc pattern=black ! video/x-raw,format=BGR,width=3840,height=2160 ! " | |||
"perf print-arm-load=true ! appsink drop=false sync=false max-buffers=3", | |||
cv::CAP_GSTREAMER); | |||
while(1){ | |||
cv::Mat frame; | |||
cap >> frame; | |||
} | |||
cap | cap.release(); | ||
return 0; | |||
} | |||
</source> | |||
* Build with | |||
<source lang=bash> | |||
g++ -o benchmark benchmark.cc `pkg-config --cflags --libs opencv4` -std=c++11 | |||
</source> | </source> | ||
* | * Run with | ||
<source lang=bash> | <source lang=bash> | ||
GST_DEBUG=perf:4 | GST_DEBUG=perf:4 ./benchmark | ||
</source> | </source> |
Revision as of 15:36, 18 September 2020
Introduction
The RidgeRun OpenCV fork is a modified version of the project with various improvements around speed and efficiency. While some changes are general (i.e.: any platform will benefit from them), others are specific to the NVIDIA Jetson family.
The fork is hosted at:
https://github.com/RidgeRun/opencv
Building the Project
Follow the instructions in our Compiling OpenCV from Source page. Make sure you select:
- RidgeRun fork
- GStreamer support
- CUDA support (if applicable)
Enhancements
GStreamer Video Capture
Effectively removes the memory copy when transferring data from the GstBuffer to the cv::Mat. Now the GstBuffer and its associated memory will remain alive throughout the lifespan of the matrix.
Tested under the following conditions
- OpenCV Version: 4.4.0
- FPS and CPU usage taken with the GstPerf element.
- The following source:
#include <opencv2/opencv.hpp> int main() { cv::VideoCapture cap( "videotestsrc pattern=black ! video/x-raw,format=BGR,width=3840,height=2160 ! " "perf print-arm-load=true ! appsink drop=false sync=false max-buffers=3", cv::CAP_GSTREAMER); while(1){ cv::Mat frame; cap >> frame; } cap.release(); return 0; }
- Build with
g++ -o benchmark benchmark.cc `pkg-config --cflags --libs opencv4` -std=c++11
- Run with
GST_DEBUG=perf:4 ./benchmark