From 4554e8d2561a386eecfa9fd145b8f1dda2d0c5b7 Mon Sep 17 00:00:00 2001 From: Daniel <1367240116@qq.com> Date: Tue, 4 Jul 2023 09:04:29 +0000 Subject: [PATCH] update video_io/sv_video_base.cpp. Signed-off-by: Daniel <1367240116@qq.com> --- video_io/sv_video_base.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/video_io/sv_video_base.cpp b/video_io/sv_video_base.cpp index 573f744..d0bd037 100644 --- a/video_io/sv_video_base.cpp +++ b/video_io/sv_video_base.cpp @@ -1133,6 +1133,22 @@ void CameraBase::openImpl() // this->_cap.open(pipe); // cv::CAP_GSTREAMER this->_cap.open(pipe, cv::CAP_GSTREAMER); } + else if (this->_type == CameraType::MIPI) + { + char pipe[512]; + this->_cap.open(this->_camera_id); + if (this->_width <= 0 || this->_height <= 0) + { + this->_width = 1280; + this->_height = 720; + } + if (this->_fps <= 0) + { + this->_fps = 30; + } + sprintf(pipe, "nvarguscamerasrc framerate=(fraction)%d/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink", this->_fps, this->_width, this->_height); + this->_cap.open(pipe, cv::CAP_GSTREAMER); + } } void CameraBase::open(CameraType type, int id) {