Go to the documentation of this file.
15 #include <opencv2/opencv.hpp>
24 cv::Point_<T> tl1 = rect1.tl();
25 cv::Point_<T> br1 = rect1.br();
26 if (tl1.inside(rect2) && br1.inside(rect2)) {
30 cv::Point_<T> tl2 = rect2.tl();
31 cv::Point_<T> br2 = rect2.br();
32 if (tl2.inside(rect1) && br2.inside(rect1)) {
41 return cv::Point_<T>(rect.x + rect.width / 2.0, rect.y + rect.height / 2.0);
46 return sqrt(pow(point2.x - point.x, 2) + pow(point2.y - point.y, 2));
50 inline cv::Point_<T>
pointsCenter(
const cv::Point_<T> &point,
const cv::Point_<T> &point2) {
51 return cv::Point_<T>((point.x + point2.x) / 2.0, (point.y + point2.y) / 2.0);
58 T
distanceBetween(
const cv::Rect_<T> &rectangle1,
const cv::Rect_<T> &rectangle2) {
84 for (
auto rectangle : rectangles) {
87 width += rectangle.width;
88 height += rectangle.height;
91 x /= rectangles.size();
92 y /= rectangles.size();
93 width /= rectangles.size();
94 height /= rectangles.size();
96 return cv::Rect_<T>(x, y, width, height);
100 bool equals(
const cv::Size_<T> &size1,
const cv::Size_<T> &size2) {
101 return size1.width == size2.width && size1.height == size2.height;
107 void rotateMatrix(
const cv::Mat &
src,
double angleDegrees, cv::Mat &target, cv::Scalar fillColor = cv::Scalar(255, 255, 255));
112 template <
typename T>
115 double adjacent = point2.x - point.x;
116 double angle = acos(adjacent / hypotenuse);
120 bool matIsEqual(
const cv::Mat &img1,
const cv::Mat &img2);
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.hpp:26470
cv::Rect_< T > averageRectangle(const vector< cv::Rect_< T >> &rectangles)
Definition: geom_opencv.h:78
string rectToString(const cv::Rect_< T > &rect)
Definition: geom_opencv.h:63
double anglePointsInRad(const cv::Point_< T > &point, const cv::Point_< T > &point2)
Definition: geom_opencv.h:113
bool equals(const cv::Size_< T > &size1, const cv::Size_< T > &size2)
Definition: geom_opencv.h:100
cv::Point_< T > rectangleCenter(const cv::Rect_< T > &rect)
Definition: geom_opencv.h:40
Definition: CscPointCloudPcdWriter.cpp:9
string sizeToString(const cv::Size_< T > &size)
Definition: geom_opencv.h:73
string pointToString(const cv::Point_< T > &point)
Definition: geom_opencv.h:68
cv::Point_< T > pointsCenter(const cv::Point_< T > &point, const cv::Point_< T > &point2)
Definition: geom_opencv.h:50
bool isIncludedInOther(const cv::Rect_< T > &rect1, const cv::Rect_< T > &rect2)
Definition: geom_opencv.h:23
void rotateMatrix(const cv::Mat &src, double angleDegrees, cv::Mat &target, cv::Scalar fillColor)
Definition: geom_opencv.cpp:27
double distanceBetween(double x1, double y1, double x2, double y2)
Definition: geom.cpp:136
cv::Vec3f rotationMatrixToEulerAngles(const cv::Mat &R)
Definition: geom_opencv.cpp:38
bool matIsEqual(const cv::Mat &img1, const cv::Mat &img2)
Definition: geom_opencv.cpp:58
const char * src
Definition: lz4.h:865
bool isRotationMatrix(const cv::Mat &R)
Definition: geom_opencv.cpp:18