修改朝向显示
This commit is contained in:
parent
497b98e2c3
commit
724a5a15e6
@ -1660,20 +1660,42 @@ void _XOYprojection_RGBD(
|
|||||||
const double deg2rad = PI / 180.0;
|
const double deg2rad = PI / 180.0;
|
||||||
const double yaw = objOps[i].centerPos.z_yaw * deg2rad;
|
const double yaw = objOps[i].centerPos.z_yaw * deg2rad;
|
||||||
double cy = cos(yaw); double sy = sin(yaw);
|
double cy = cos(yaw); double sy = sin(yaw);
|
||||||
double x1 = objOps[i].centerPos.x + R * cy; double y1 = objOps[i].centerPos.y - R * sy;
|
double arrowLen = R/3;
|
||||||
double x2 = objOps[i].centerPos.x - R * cy; double y2 = objOps[i].centerPos.y + R * sy;
|
double arrowAngle = 30;
|
||||||
int px1 = (int)((x1 - x_range.min) / x_scale + x_skip);
|
double ca = cos(arrowAngle * deg2rad);
|
||||||
int py1 = (int)((y1 - y_range.min) / y_scale + y_skip);
|
double sa = sin(arrowAngle * deg2rad);
|
||||||
int px2 = (int)((x2 - x_range.min) / x_scale + x_skip);
|
SVzNL2DPointD endingPt[4];
|
||||||
int py2 = (int)((y2 - y_range.min) / y_scale + y_skip);
|
endingPt[0] = { R, 0 };
|
||||||
|
endingPt[1] = { -R, 0 };
|
||||||
|
endingPt[2] = { R - arrowLen * ca, -arrowLen * sa };
|
||||||
|
endingPt[3] = { R - arrowLen * ca, arrowLen * sa };
|
||||||
|
for (int m = 0; m < 4; m++)
|
||||||
|
{
|
||||||
|
double tmp_x = endingPt[m].x * cy - endingPt[m].y * sy;
|
||||||
|
double tmp_y = -endingPt[m].x * sy - endingPt[m].y * cy;
|
||||||
|
endingPt[m].x = tmp_x + objOps[i].centerPos.x;
|
||||||
|
endingPt[m].y = tmp_y + objOps[i].centerPos.y;
|
||||||
|
}
|
||||||
|
int px1 = (int)((endingPt[0].x - x_range.min) / x_scale + x_skip);
|
||||||
|
int py1 = (int)((endingPt[0].y - y_range.min) / y_scale + y_skip);
|
||||||
|
int px2 = (int)((endingPt[1].x - x_range.min) / x_scale + x_skip);
|
||||||
|
int py2 = (int)((endingPt[1].y - y_range.min) / y_scale + y_skip);
|
||||||
cv::line(img, cv::Point(px1, py1), cv::Point(px2, py2), cv::Scalar(rgb[2], rgb[1], rgb[0]), 2);
|
cv::line(img, cv::Point(px1, py1), cv::Point(px2, py2), cv::Scalar(rgb[2], rgb[1], rgb[0]), 2);
|
||||||
|
int px3 = (int)((endingPt[2].x - x_range.min) / x_scale + x_skip);
|
||||||
|
int py3 = (int)((endingPt[2].y - y_range.min) / y_scale + y_skip);
|
||||||
|
int px4 = (int)((endingPt[3].x - x_range.min) / x_scale + x_skip);
|
||||||
|
int py4 = (int)((endingPt[3].y - y_range.min) / y_scale + y_skip);
|
||||||
if (objOps[i].orienFlag == 1)
|
if (objOps[i].orienFlag == 1)
|
||||||
{
|
{
|
||||||
cv::circle(img, cv::Point(px1, py1), 5, cv::Scalar(0, 255, 0), -1);
|
cv::line(img, cv::Point(px1, py1), cv::Point(px3, py3), cv::Scalar(0, 255, 0), 2);
|
||||||
|
cv::line(img, cv::Point(px1, py1), cv::Point(px4, py4), cv::Scalar(0, 255, 0), 2);
|
||||||
|
//cv::circle(img, cv::Point(px1, py1), 5, cv::Scalar(0, 255, 0), -1);
|
||||||
}
|
}
|
||||||
else if (objOps[i].orienFlag == 2)
|
else if (objOps[i].orienFlag == 2)
|
||||||
{
|
{
|
||||||
cv::circle(img, cv::Point(px1, py1), 5, cv::Scalar(0, 0, 255), -1);
|
cv::line(img, cv::Point(px1, py1), cv::Point(px3, py3), cv::Scalar(0, 0, 255), 2);
|
||||||
|
cv::line(img, cv::Point(px1, py1), cv::Point(px4, py4), cv::Scalar(0, 0, 255), 2);
|
||||||
|
//cv::circle(img, cv::Point(px1, py1), 5, cv::Scalar(0, 0, 255), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2682,7 +2704,7 @@ int main()
|
|||||||
}
|
}
|
||||||
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++)
|
||||||
{
|
{
|
||||||
fidx = 10;
|
//fidx = 10;
|
||||||
if (grp < TEST_TOP_VIEW_GROUP) //正面抓取
|
if (grp < TEST_TOP_VIEW_GROUP) //正面抓取
|
||||||
{
|
{
|
||||||
int lineNum = 0;
|
int lineNum = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user