This commit is contained in:
ackimixs
2024-05-06 15:22:27 +02:00
parent 396748f861
commit c2a109463b

View File

@@ -1,7 +1,5 @@
#include "ArucoDetector.h"
#include <pstl/glue_execution_defs.h>
ArucoDetector::ArucoDetector(const std::string& calibrationPath, const Team team, const bool headless) : headless(headless), team(team)
{
// opencv 4.8
@@ -91,7 +89,14 @@ std::pair<int, std::vector<std::pair<ArucoTag, std::pair<cv::Mat, cv::Mat>>>> Ar
cv::Mat frameNotRotated;
cv::Mat frameDistored;
cam->getVideoFrame(frameNotRotated, 1000);
try {
cam->getVideoFrame(frameNotRotated, 1000);
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
std::pair<int, std::vector<std::pair<ArucoTag, std::pair<cv::Mat, cv::Mat>>>> result;
result.first = -2;
return result;
}
cv::flip(frameNotRotated, frameDistored, -1);
cv::undistort(frameDistored, frame, cameraMatrix, distCoeffs);