From 247ce0e1cb8500555de75bd6ec6da420c0b5d246 Mon Sep 17 00:00:00 2001 From: ackimixs Date: Sat, 10 Feb 2024 18:41:33 +0100 Subject: [PATCH] up --- aruco/ArucoDetector.cpp | 15 ++++++++------- aruco/ArucoDetector.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/aruco/ArucoDetector.cpp b/aruco/ArucoDetector.cpp index c35d6d7..dfec570 100644 --- a/aruco/ArucoDetector.cpp +++ b/aruco/ArucoDetector.cpp @@ -20,10 +20,11 @@ ArucoDetector::ArucoDetector(const Type::RobotPose& pose, const std::string& cal this->readCameraParameters(calibrationPath); // this->cap = cv::VideoCapture(cameraId); - cam.options->video_width=1920; - cam.options->video_height=1080; - cam.options->framerate=30; - cam.options->verbose=true; + this->cam = new lccv::PiCamera(); + cam->options->video_width=1920; + cam->options->video_height=1080; + cam->options->framerate=10; + cam->options->verbose=true; /* if (!cap.isOpened()) { std::cerr << "Error opening camera." << std::endl; @@ -47,7 +48,7 @@ ArucoDetector::ArucoDetector(const Type::RobotPose& pose, const std::string& cal this->addArucoTag(ArucoTag(47, "Solar panel", 50, SOLAR_PANEL)); - cam.startVideo(); + cam->startVideo(); } ArucoDetector::ArucoDetector(const float x, const float y, const float z, const float theta, const std::string& calibrationPath, const Team team, const int cameraId, const bool headless) : ArucoDetector(Type::RobotPose{cv::Point3f(x, y, z), theta}, calibrationPath, team, cameraId, headless) @@ -56,7 +57,7 @@ ArucoDetector::ArucoDetector(const float x, const float y, const float z, const ArucoDetector::~ArucoDetector() { - cam.stopVideo(); + cam->stopVideo(); cv::destroyAllWindows(); } @@ -93,7 +94,7 @@ std::pair>>> Ar } cv::Mat frame; - cam.getVideoFrame(frame, 1000); + 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 a89c99d..397e272 100644 --- a/aruco/ArucoDetector.h +++ b/aruco/ArucoDetector.h @@ -13,7 +13,7 @@ class ArucoDetector { cv::Mat distCoeffs; // cv::VideoCapture cap; - lccv::PiCamera cam; + lccv::PiCamera* cam; // 4.6 cv::Ptr dictionary;