add the way to open G1 in X86_CUDA

This commit is contained in:
lxm 2023-07-19 18:15:59 +08:00
parent 954551aa3f
commit 73b5f46e6d
2 changed files with 10 additions and 3 deletions

View File

@ -1110,7 +1110,7 @@ void CameraBase::_run()
} }
bool CameraBase::read(cv::Mat& image) 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; int n_try = 0;
while (n_try < 5000) while (n_try < 5000)

View File

@ -67,8 +67,15 @@ void Camera::openImpl()
this->_fps = 30; 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) else if (this->_type == CameraType::MIPI)
{ {