halcon 斜矩形顶点问题

关于halcon 版本

read_image(Image, 'fabrik')
get_image_size(Image, Width, Height)
dev_display(Image)
dev_set_draw('margin')
draw_rectangle2(3600, Row, Column, Phi, Length1, Length2)
gen_rectangle2(Rectangle, Row, Column, Phi, Length1, Length2)
tuple_cos (Phi, Cos)
tuple_sin (Phi, Sin)
dev_set_color('green')
RT_X := -Length1*Cos - Length2*Sin
RT_Y := -Length1*Sin + Length2*Cos
gen_circle (Circle, Row-RT_Y, Column+RT_X, 10)
RB_X := Length1*Cos - Length2*Sin
RB_Y := Length1*Sin + Length2*Cos
gen_circle (Circle, Row-RB_Y, Column+RB_X, 10)
LB_X := Length1*Cos + Length2*Sin
LB_Y := Length1*Sin - Length2*Cos
gen_circle (Circle, Row-LB_Y, Column+LB_X, 10)
LT_X := -Length1*Cos + Length2*Sin
LT_Y := -Length1*Sin - Length2*Cos
gen_circle (Circle, Row-LT_Y, Column+LT_X, 10)

C++版本

			Point2f arry[4] = {};
			float a = (float)(-Rect_points[0][1].x*cos(Rect_points[0][2].x) - Rect_points[0][1].y*sin(Rect_points[0][2].x));
			float b = (float)(-Rect_points[0][1].x*sin(Rect_points[0][2].x) + Rect_points[0][1].y*cos(Rect_points[0][2].x));
			Point2f A(Rect_points[0][0].x - b, Rect_points[0][0].y + a);
			float c = (float)(Rect_points[0][1].x*cos(Rect_points[0][2].x) - Rect_points[0][1].y*sin(Rect_points[0][2].x));
			float d = (float)(Rect_points[0][1].x*sin(Rect_points[0][2].x) + Rect_points[0][1].y*cos(Rect_points[0][2].x));
			Point2f B(Rect_points[0][0].x - d, Rect_points[0][0].y + c);
			float e = (float)(Rect_points[0][1].x*cos(Rect_points[0][2].x) + Rect_points[0][1].y*sin(Rect_points[0][2].x));
			float f = (float)(Rect_points[0][1].x*sin(Rect_points[0][2].x) - Rect_points[0][1].y*cos(Rect_points[0][2].x));
			Point2f C(Rect_points[0][0].x - f, Rect_points[0][0].y + e);
			float g = (float)(-Rect_points[0][1].x*cos(Rect_points[0][2].x) + Rect_points[0][1].y*sin(Rect_points[0][2].x));
			float h = (float)(-Rect_points[0][1].x*sin(Rect_points[0][2].x) - Rect_points[0][1].y*cos(Rect_points[0][2].x));
			Point2f D(Rect_points[0][0].x - h, Rect_points[0][0].y + g);
			arry[0] = A; arry[1] = B; arry[2] = C; arry[3] = D;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沐雨清风 จุ๊บ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值