add aruco member funs

This commit is contained in:
jario-jin 2023-12-15 22:13:32 +08:00
parent dd3216e19e
commit c74319529c
4 changed files with 17 additions and 0 deletions

View File

@ -80,6 +80,12 @@ ArucoDetector::ArucoDetector()
} }
void ArucoDetector::getIdsWithLengths(std::vector<int>& ids_, std::vector<double>& lengths_)
{
ids_ = this->_ids_need;
lengths_ = this->_lengths_need;
}
void ArucoDetector::_load() void ArucoDetector::_load()
{ {
JsonValue all_value; JsonValue all_value;

View File

@ -46,6 +46,7 @@ class ArucoDetector : public CameraAlgorithm
public: public:
ArucoDetector(); ArucoDetector();
void detect(cv::Mat img_, TargetsInFrame& tgts_); void detect(cv::Mat img_, TargetsInFrame& tgts_);
void getIdsWithLengths(std::vector<int>& ids_, std::vector<double>& lengths_);
private: private:
void _load(); void _load();
bool _params_loaded; bool _params_loaded;

View File

@ -128,6 +128,7 @@ public:
bool getBox(Box& b); bool getBox(Box& b);
bool getAruco(int& id, std::vector<cv::Point2f> &corners); bool getAruco(int& id, std::vector<cv::Point2f> &corners);
bool getAruco(int& id, std::vector<cv::Point2f> &corners, cv::Vec3d &rvecs, cv::Vec3d &tvecs);
bool getEllipse(double& xc_, double& yc_, double& a_, double& b_, double& rad_); bool getEllipse(double& xc_, double& yc_, double& a_, double& b_, double& rad_);
std::string getJsonStr(); std::string getJsonStr();

View File

@ -588,6 +588,15 @@ bool Target::getAruco(int& id, std::vector<cv::Point2f> &corners)
return this->has_aruco; return this->has_aruco;
} }
bool Target::getAruco(int& id, std::vector<cv::Point2f> &corners, cv::Vec3d &rvecs, cv::Vec3d &tvecs)
{
id = this->_a_id;
corners = this->_a_corners;
rvecs = this->_a_rvecs;
tvecs = this->_a_tvecs;
return this->has_aruco;
}
bool Target::getBox(Box& b) bool Target::getBox(Box& b)
{ {
b = this->_b_box; b = this->_b_box;