update video_io/sv_video_base.cpp.

Signed-off-by: Daniel <1367240116@qq.com>
This commit is contained in:
Daniel 2023-07-04 09:04:29 +00:00 committed by Gitee
parent 8b56141b14
commit 4554e8d256
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 16 additions and 0 deletions

View File

@ -1133,6 +1133,22 @@ void CameraBase::openImpl()
// this->_cap.open(pipe); // cv::CAP_GSTREAMER // this->_cap.open(pipe); // cv::CAP_GSTREAMER
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) void CameraBase::open(CameraType type, int id)
{ {