diff --git a/aruco/ArucoDetector.cpp b/aruco/ArucoDetector.cpp index f93c68f..ea17961 100644 --- a/aruco/ArucoDetector.cpp +++ b/aruco/ArucoDetector.cpp @@ -19,14 +19,20 @@ ArucoDetector::ArucoDetector(const Type::RobotPose& pose, const std::string& cal ); this->readCameraParameters(calibrationPath); - this->cap = cv::VideoCapture(cameraId); + // this->cap = cv::VideoCapture(cameraId); + this->cam = lccv::PiCamera; + cam.options->video_width=1920; + cam.options->video_height=1080; + cam.options->framerate=60; + cam.options->verbose=true; - if (!cap.isOpened()) { +/* if (!cap.isOpened()) { std::cerr << "Error opening camera." << std::endl; } else { started = true; - } + }*/ + started = true; if (!headless) { @@ -49,7 +55,7 @@ ArucoDetector::ArucoDetector(const float x, const float y, const float z, const ArucoDetector::~ArucoDetector() { - cap.release(); + cam.stopVideo(); cv::destroyAllWindows(); } @@ -86,7 +92,8 @@ std::pair>>> Ar } cv::Mat frame; - cap >> frame; // Capture frame from the camera + cam.getVideoFrame(frame, 1); + // cap >> frame; // Capture frame from the camera std::pair>>> result; diff --git a/aruco/ArucoDetector.h b/aruco/ArucoDetector.h index 3f05eeb..a89c99d 100644 --- a/aruco/ArucoDetector.h +++ b/aruco/ArucoDetector.h @@ -2,6 +2,7 @@ #include "../utils/utils.h" #include "ArucoTag.h" +#include class ArucoDetector { std::vector arucoTags; @@ -11,7 +12,8 @@ class ArucoDetector { cv::Mat cameraMatrix; cv::Mat distCoeffs; - cv::VideoCapture cap; + // cv::VideoCapture cap; + lccv::PiCamera cam; // 4.6 cv::Ptr dictionary;