mirror of
https://github.com/modelec/detection_pot.git
synced 2026-01-18 16:47:33 +01:00
arucoTag class
This commit is contained in:
1
utils/ArucoTag.cpp
Normal file
1
utils/ArucoTag.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "ArucoTag.h"
|
||||
37
utils/ArucoTag.h
Normal file
37
utils/ArucoTag.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <utility>
|
||||
|
||||
enum ArucoTagType
|
||||
{
|
||||
FLOWER,
|
||||
SOLAR_PANEL
|
||||
};
|
||||
|
||||
class ArucoTag {
|
||||
public:
|
||||
int id;
|
||||
std::string name;
|
||||
float length;
|
||||
cv::Mat objectRepresenation;
|
||||
ArucoTagType type;
|
||||
|
||||
ArucoTag(const int id, std::string name, const float length, const ArucoTagType type) : id(id), name(std::move(name)), length(length), type(type)
|
||||
{
|
||||
this->objectRepresenation = cv::Mat(4, 1, CV_32FC3);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[0] = cv::Vec3f(-length/2.f, length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[1] = cv::Vec3f(length/2.f, length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[2] = cv::Vec3f(length/2.f, -length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[3] = cv::Vec3f(-length/2.f, -length/2.f, 0);
|
||||
}
|
||||
|
||||
void setFlowerObjectRepresentation()
|
||||
{
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[0] = cv::Vec3f(-length/2.f, length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[1] = cv::Vec3f(length/2.f, length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[2] = cv::Vec3f(length/2.f, -length/2.f, 0);
|
||||
this->objectRepresenation.ptr<cv::Vec3f>(0)[3] = cv::Vec3f(-length/2.f, -length/2.f, 0);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user