From 5f832abaf0bcb693c77b92be2de310c838a92e2f Mon Sep 17 00:00:00 2001 From: lxm <1367240116@qq.com> Date: Wed, 19 Jul 2023 18:15:59 +0800 Subject: [PATCH 1/2] add the way to open G1 in X86_CUDA --- video_io/sv_video_base.cpp | 2 +- video_io/sv_video_input.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/video_io/sv_video_base.cpp b/video_io/sv_video_base.cpp index b4da4e5..cb57fe8 100644 --- a/video_io/sv_video_base.cpp +++ b/video_io/sv_video_base.cpp @@ -1110,7 +1110,7 @@ void CameraBase::_run() } bool CameraBase::read(cv::Mat& image) { - if (this->_type == CameraType::WEBCAM || this->_type == CameraType::G1) + if (this->_type == CameraType::WEBCAM || this->_type == CameraType::G1 || this->_type == CameraType::MIPI) { int n_try = 0; while (n_try < 5000) diff --git a/video_io/sv_video_input.cpp b/video_io/sv_video_input.cpp index 18e34c4..6f811ff 100644 --- a/video_io/sv_video_input.cpp +++ b/video_io/sv_video_input.cpp @@ -67,8 +67,15 @@ void Camera::openImpl() this->_fps = 30; } - sprintf(pipe, "rtspsrc location=rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000 latency=100 ! application/x-rtp,media=video ! rtph264depay ! parsebin ! nvv4l2decoder enable-max-performancegst=1 ! nvvidconv ! video/x-raw,format=(string)BGRx ! videoconvert ! appsink sync=false", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); - this->_cap.open(pipe, cv::CAP_GSTREAMER); + + #ifdef PLATFORM_X86_CUDA + sprintf(pipe, "rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); + this->_cap.open(pipe); + #endif + #ifdef PLATFORM_JETSON + sprintf(pipe, "rtspsrc location=rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000 latency=100 ! application/x-rtp,media=video ! rtph264depay ! parsebin ! nvv4l2decoder enable-max-performancegst=1 ! nvvidconv ! video/x-raw,format=(string)BGRx ! videoconvert ! appsink sync=false", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); + this->_cap.open(pipe, cv::CAP_GSTREAMER); + #endif } else if (this->_type == CameraType::MIPI) { From b810d4728df676b3e17493938da207b6ef6f39a9 Mon Sep 17 00:00:00 2001 From: jario-jin Date: Thu, 20 Jul 2023 09:36:10 +0000 Subject: [PATCH 2/2] =?UTF-8?q?update=20video=5Fio/sv=5Fvideo=5Finput.cpp.?= =?UTF-8?q?=20=E9=A2=84=E7=BC=96=E8=AF=91=E6=8C=87=E4=BB=A4=E9=A1=B6?= =?UTF-8?q?=E6=A0=BC=E5=86=99=EF=BC=8C=E6=B3=A8=E6=84=8F=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jario-jin --- video_io/sv_video_input.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/video_io/sv_video_input.cpp b/video_io/sv_video_input.cpp index 6f811ff..60f0319 100644 --- a/video_io/sv_video_input.cpp +++ b/video_io/sv_video_input.cpp @@ -67,15 +67,14 @@ void Camera::openImpl() this->_fps = 30; } - - #ifdef PLATFORM_X86_CUDA - sprintf(pipe, "rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); - this->_cap.open(pipe); - #endif - #ifdef PLATFORM_JETSON - sprintf(pipe, "rtspsrc location=rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000 latency=100 ! application/x-rtp,media=video ! rtph264depay ! parsebin ! nvv4l2decoder enable-max-performancegst=1 ! nvvidconv ! video/x-raw,format=(string)BGRx ! videoconvert ! appsink sync=false", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); - this->_cap.open(pipe, cv::CAP_GSTREAMER); - #endif +#ifdef PLATFORM_X86_CUDA + sprintf(pipe, "rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); + this->_cap.open(pipe); +#endif +#ifdef PLATFORM_JETSON + sprintf(pipe, "rtspsrc location=rtsp://%s:%d/H264?W=%d&H=%d&FPS=%d&BR=4000000 latency=100 ! application/x-rtp,media=video ! rtph264depay ! parsebin ! nvv4l2decoder enable-max-performancegst=1 ! nvvidconv ! video/x-raw,format=(string)BGRx ! videoconvert ! appsink sync=false", this->_ip.c_str(), this->_port, this->_width, this->_height, this->_fps); + this->_cap.open(pipe, cv::CAP_GSTREAMER); +#endif } else if (this->_type == CameraType::MIPI) {