-------------------------------------------------------------------------- */ add circles in the image at desired position/size/color
| 17 | /* -------------------------------------------------------------------------- */ |
| 18 | // add circles in the image at desired position/size/color |
| 19 | void UtilsOpenCV::DrawCirclesInPlace(cv::Mat& img, |
| 20 | const KeypointsCV& image_points, |
| 21 | const cv::Scalar& color, |
| 22 | const double& msize, |
| 23 | const std::vector<int>& point_ids, |
| 24 | const int& rem_id) { |
| 25 | // text offset |
| 26 | cv::Point2f text_offset(-10, -5); |
| 27 | if (img.channels() < 3) cv::cvtColor(img, img, cv::COLOR_GRAY2BGR); |
| 28 | for (size_t i = 0u; i < image_points.size(); i++) { |
| 29 | cv::circle(img, image_points[i], msize, color, 2); |
| 30 | if (point_ids.size() == image_points.size()) { |
| 31 | // We also have text |
| 32 | cv::putText(img, |
| 33 | std::to_string(point_ids[i] % rem_id), |
| 34 | image_points[i] + text_offset, |
| 35 | cv::FONT_HERSHEY_COMPLEX, |
| 36 | 0.5, |
| 37 | color); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | /* -------------------------------------------------------------------------- */ |
| 42 | // add squares in the image at desired position/size/color |
| 43 | void UtilsOpenCV::DrawSquaresInPlace(cv::Mat& img, |