From ae21d40e2b8058cfd9b072afdc609b25a9fd5c06 Mon Sep 17 00:00:00 2001 From: jario Date: Sun, 26 Nov 2023 21:26:27 +0800 Subject: [PATCH 1/2] fix intel building sh --- CMakeLists.txt | 2 +- algorithm/veri/sv_veri_det.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2986df..aeb6116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,7 +309,7 @@ if(USE_CUDA) RUNTIME DESTINATION bin ) elseif(PLATFORM STREQUAL "X86_INTEL") - install(TARGETS sv_world + install(TARGETS sv_gimbal sv_world LIBRARY DESTINATION lib ) endif() diff --git a/algorithm/veri/sv_veri_det.cpp b/algorithm/veri/sv_veri_det.cpp index bf12630..17cba0d 100644 --- a/algorithm/veri/sv_veri_det.cpp +++ b/algorithm/veri/sv_veri_det.cpp @@ -17,7 +17,9 @@ namespace sv VeriDetector::VeriDetector() { +#ifdef WITH_CUDA this->_cuda_impl = new VeriDetectorCUDAImpl; +#endif } VeriDetector::~VeriDetector() { @@ -96,7 +98,7 @@ namespace sv #ifdef WITH_CUDA std::vector output_labels; roiCNN(input_rois_, output_labels); -#endif + // auto t1 = std::chrono::system_clock::now(); // tgts_.setFPS(1000.0 / std::chrono::duration_cast(t1 - this->_t0).count()); // this->_t0 = std::chrono::system_clock::now(); @@ -108,6 +110,7 @@ namespace sv tgt.sim_score = output_labels[1]; // tgts_.targets.push_back(tgt); } +#endif } void VeriDetector::getSubwindow(cv::Mat &dstCrop, cv::Mat &srcImg, int originalSz, int resizeSz) From 4e4a479b0809c5dcae80facb9972ef26f3bd0fda Mon Sep 17 00:00:00 2001 From: jario Date: Mon, 27 Nov 2023 18:05:20 +0800 Subject: [PATCH 2/2] added support for V4L2CAM --- include/sv_video_base.h | 2 +- video_io/sv_video_base.cpp | 2 +- video_io/sv_video_input.cpp | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/sv_video_base.h b/include/sv_video_base.h index 5c20051..e9ee23c 100644 --- a/include/sv_video_base.h +++ b/include/sv_video_base.h @@ -326,7 +326,7 @@ protected: }; -enum class CameraType {NONE, WEBCAM, G1, Q10, MIPI}; +enum class CameraType {NONE, WEBCAM, V4L2CAM, G1, Q10, MIPI}; class CameraBase { public: diff --git a/video_io/sv_video_base.cpp b/video_io/sv_video_base.cpp index ea57b54..3a78973 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 || this->_type == CameraType::MIPI) + if (this->_type != CameraType::NONE) { 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 5ca7bfa..4bdde60 100644 --- a/video_io/sv_video_input.cpp +++ b/video_io/sv_video_input.cpp @@ -17,9 +17,17 @@ Camera::~Camera() void Camera::openImpl() { - if (this->_type == CameraType::WEBCAM) + if (this->_type == CameraType::WEBCAM || this->_type == CameraType::V4L2CAM) { - this->_cap.open(this->_camera_id); + if (this->_type == CameraType::V4L2CAM) + { + this->_cap.open(this->_camera_id, cv::CAP_V4L2); + } + if (this->_type == CameraType::WEBCAM) + { + this->_cap.open(this->_camera_id); + } + if (this->_width > 0 && this->_height > 0) { this->_cap.set(cv::CAP_PROP_FRAME_WIDTH, this->_width);