-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,768 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2022-2023, William Wei. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "drawfunc.h" | ||
#include <opencv2/core/eigen.hpp> | ||
#include <opencv2/aruco.hpp> | ||
#include <vector> | ||
|
||
namespace aruconavi { | ||
void Painter::draw_coordinate_system(const Eigen::Matrix3f& intrinsic_matrix, | ||
const Eigen::Vector<float, 5>& dist_coef, | ||
const cv::Vec3d& rvec, | ||
const cv::Vec3d& tvec) { | ||
cv::Mat intrinsic_matrix_cv, dist_coef_cv; | ||
cv::eigen2cv(intrinsic_matrix, intrinsic_matrix_cv); | ||
cv::eigen2cv(dist_coef, dist_coef_cv); | ||
cv::drawFrameAxes(image_, intrinsic_matrix_cv, dist_coef_cv, rvec, tvec, | ||
0.1); | ||
} | ||
|
||
void Painter::draw_detected_markers( | ||
std::pair<std::vector<int>, std::vector<std::vector<cv::Point2f>>> | ||
pairs) { | ||
std::vector<int> marked_ids = pairs.first; | ||
std::vector<std::vector<cv::Point2f>> marked_corners = pairs.second; | ||
if (marked_ids.size() > 0) { | ||
cv::aruco::drawDetectedMarkers(image_, marked_corners, marked_ids); | ||
} | ||
} | ||
|
||
} // namespace aruconavi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2022-2023, William Wei. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef BLIND_ASSIST_DRAWFUNC_H | ||
#define BLIND_ASSIST_DRAWFUNC_H | ||
#include <opencv2/opencv.hpp> | ||
#include <Eigen/Dense> | ||
|
||
namespace aruconavi { | ||
void draw_coordinate_system(cv::Mat& image, | ||
const Eigen::Matrix3f& intrinsic_matrix, | ||
const Eigen::Vector<float, 5>& dist_coef, | ||
const cv::Vec3d& rvec, const cv::Vec3d& tvec); | ||
|
||
class Painter { | ||
public: | ||
cv::Mat image_; | ||
|
||
public: | ||
Painter(cv::Mat image) : image_(image) {} | ||
// for coordinate axis, we only draw the nearest one(i.e. the smallest id) | ||
void draw_coordinate_system(const Eigen::Matrix3f& intrinsic_matrix, | ||
const Eigen::Vector<float, 5>& dist_coef, | ||
const cv::Vec3d& rvec, const cv::Vec3d& tvec); | ||
void draw_detected_markers( | ||
std::pair<std::vector<int>, std::vector<std::vector<cv::Point2f>>> | ||
pairs); | ||
void draw_text(); | ||
~Painter() = default; | ||
}; | ||
} // namespace aruconavi | ||
#endif // BLIND_ASSIST_DRAWFUNC_H |
Oops, something went wrong.