使用opencv搭建gstreamer pipeline

opencv 提供了相关的接口用来搭建gstreamer pipeline

cpp

cv::VideoCapture cap;
cap.open("rtsp://admin:[email protected]:554/client1x",cv::CAP_GSTREAMER);


cv::Mat frame;

while(cv::waitKey(1) < 0) // Press any key to exit
{
    if (!cap.read(frame))
    {
        cerr << "No frames grabbed!\n";
        break;
    }
}
}   

python

import cv2 as cv


cap = cv.VideoCapture('rtsp://admin:[email protected]:554/client1x',cv.CAP_GSTREAMER)
while cv.waitKey(1) < 0:
    hasFrame, frame = cap.read()

    if not hasFrame:
        break

    cv.imshow("rtsp", frame)

你可能感兴趣的:(encode_decode,opencv,计算机视觉,人工智能)