Commit 587f3fe9 authored by oscar's avatar oscar

change param for points

parent 16e6aa83
......@@ -118,7 +118,7 @@ float calcIntersectionRate(cv::RotatedRect rect1, cv::RotatedRect rect2)
return iou_2d;
}
double calculate_angle(std::vector<point2d>& points)
double calculate_angle(std::vector<std::vector<float>>& points)
{
if (points.size() < 5)
return 0;
......@@ -126,8 +126,8 @@ double calculate_angle(std::vector<point2d>& points)
// 坐标 (1, 1), (2, 2), (3, 3)
for (int i = 0; i < 5; i++)
{
X(i, 0) = points[i].x;
X(i, 1) = points[i].y;
X(i, 0) = points[i][0];
X(i, 1) = points[i][1];
}
Eigen::MatrixXd X_copy = X; // 拷贝副本,因为X取均值后会被改变
Eigen::MatrixXd C(2, 2); // 方差
......@@ -147,7 +147,7 @@ double calculate_angle(std::vector<point2d>& points)
//SDK_LOG(SDK_INFO, "val = [%f,%f]", val(0), val(1));
// 打印
//cout << "X_copy: " << endl << X_copy
Eigen::Vector2d dX(points[4].x - points[0].x, points[4].y - points[0].y);
Eigen::Vector2d dX(points[4][0] - points[0][0], points[4][1] - points[0][1]);
Eigen::Vector2d orientation(vec(1, 0), vec(1, 1));
double alpha = dX.transpose() * orientation;
if (alpha < 0)
......
......@@ -20,4 +20,4 @@ double calcIntersectionArea(cv::RotatedRect rect1, cv::RotatedRect rect2);
float calcIntersectionRate(cv::RotatedRect rect1, cv::RotatedRect rect2);
double calculate_angle(std::vector<point2d>& points)
double calculate_angle(std::vector<std::vector<float>>& points)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment