4 #include <opencv2/opencv.hpp> 9 #define if_less_equal(num, condition) if (num < condition) { num = condition; } 10 #define if_more_equal(num, condition) if (num > condition) { num = condition; } 11 #define if_more_swap(num1, num2) if (num1 > num2) { std::swap(num1, num2); } 21 double calcLineDegree(
const cv::Point2f& firstPt,
const cv::Point2f& secondPt);
26 double getRcDegree(
const cv::RotatedRect &box);
33 std::pair<double, double> get_linear_parameters(T x1, T y1, T x2, T y2);
40 std::pair<double, double> get_linear_parameters(T point1, T point2);
47 T get_linear_x(
double coefficient,
double intercept, T y);
54 T get_linear_y(
double coefficient,
double intercept, T x);
61 void for_each(
const cv::RotatedRect &rect,
const std::function<
void(
int,
int)> &func,
int xstep = 1,
int ystep = 1);
72 void for_each(
const cv::RotatedRect &rect,
float xmin,
float ymin,
float xmax,
float ymax,
const std::function<
void(
int,
int)> &func,
int xstep = 1,
int ystep = 1);
79 double squaredist(
const cv::Point_<T> &point1,
const cv::Point_<T> &point2);
88 double squaredist(T x1, T y1, T x2, T y2);
95 double distance(
const cv::Point_<T> &point1,
const cv::Point_<T> &point2);
103 template <
typename T>
104 double distance(T x1, T y1, T x2, T y2);
110 template <
typename T>
111 T center_point(
const T &point1,
const T &point2);
118 template <
typename T>
119 double point_to_line(
double coefficient,
double intercept,
const T &point);
126 template <
typename T>
127 bool point_in_line(
const T &point1,
const T &point2,
const T &point);
131 #endif // __UTILITY_H__