Jump to content

RidgeRun OpenCV Fork: Difference between revisions

(Undo revision 32958 by Mgruner (talk))
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 script:
* The following source:
<source lang=python>
<source lang=c++>
import cv2 as cv
#include <opencv2/opencv.hpp>


PIPE = "videotestsrc pattern=black ! \
int main() {
        video/x-raw,format=BGR,width=1920,height=1080 ! \
  cv::VideoCapture cap(
        perf print-arm-load=true ! \
    "videotestsrc pattern=black ! video/x-raw,format=BGR,width=3840,height=2160 ! "
        appsink sync=false drop=false max-buffers=3"
    "perf print-arm-load=true ! appsink drop=false sync=false max-buffers=3",
    cv::CAP_GSTREAMER);
 
  while(1){
    cv::Mat frame;
    cap >> frame;
  }


cap = cv.VideoCapture(PIPE, cv.CAP_GSTREAMER)
  cap.release();
 
  return 0;
while True:
}
    ret, frame = cap.read()
</source>
 
* Build with
cap.release()
<source lang=bash>
cv.destroyAllWindows()
g++ -o benchmark benchmark.cc `pkg-config --cflags --libs opencv4` -std=c++11
</source>
</source>
* Execution:
* Run with
<source lang=bash>
<source lang=bash>
GST_DEBUG=perf:4 python3 ./benchmark.py
GST_DEBUG=perf:4 ./benchmark
</source>
</source>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.