当前位置:网站首页>[Halcon&几何] 直线的垂线与延长线的计算
[Halcon&几何] 直线的垂线与延长线的计算
2022-08-09 10:00:00 【丶布布】
一、直线垂直线的计算
1、函数源码
dev_close_window ()
dev_open_window (0, 0, 400, 400, 'black', WindowHandle)
draw_line (WindowHandle, Row1, Col1, Row2, Col2)
*获取直线角度
gen_region_line (RegionLines2, Row1, Col1, Row2, Col2)
gen_contour_region_xld (RegionLines2, Contours, 'border')
elliptic_axis_points_xld (Contours, Ra3, Rb3, Phi)
*获取直线中点
area_center_points_xld (Contours, Area4, RowCenter, ColCenter)
*垂线长度
LineLength:=200
*起点
RowStart := RowCenter-cos(Phi)*LineLength
ColStart := ColCenter-sin(Phi)*LineLength
*终点
RowEnd := RowCenter+cos(Phi)*LineLength
ColEnd := ColCenter+sin(Phi)*LineLength
gen_region_line (Line1, RowStart, ColStart, RowEnd, ColEnd)
2、计算效果
二、直线延长线的计算
1、函数源码
dev_close_window ()
dev_open_window (0, 0, 700, 700, 'black', WindowHandle)
draw_line (WindowHandle, Row1, Col1, Row2, Col2)
*获取直线角度
gen_region_line (RegionLines2, Row1, Col1, Row2, Col2)
gen_contour_region_xld (RegionLines2, Contours, 'border')
elliptic_axis_points_xld (Contours, Ra3, Rb3, Phi)
*获取直线中点
area_center_points_xld (Contours, Area4, RowCenter, ColCenter)
***********************生成延长线*************************
*延长线长度
LineLength:=1100
*起点
RowStart := RowCenter-cos(Phi+1.5708)*LineLength
ColStart := ColCenter-sin(Phi+1.5708)*LineLength
*终点
RowEnd := RowCenter-cos(Phi-1.5708)*LineLength
ColEnd := ColCenter-sin(Phi-1.5708)*LineLength
gen_region_line (Line2, RowStart, ColStart, RowEnd, ColEnd)
dev_display (Line2)
2、计算效果
注: elliptic_axis_points_xld获取直线的角度较line_orientation和line_position求直线角度而言,计算出的延长线精度会更高,可以自行验证,其他角度计算方法可以参考我的博文:[Halcon] 直线中点、端点和角度的计算
戳戳小手帮忙点个免费的赞和关注吧,嘿嘿。 |
边栏推荐
- .ts 音频文件转换成 .mp3 文件
- 常用命令之思科常用基础配置
- 极域Killer 1.0代码
- 6.Map interface and implementation class
- [Machine Learning] Detailed explanation of web crawler combat
- KeyBERT和labse提取字符串中的关键词
- 记录一次被入侵5900端口经历
- 技术分享 | 使用 cURL 发送请求
- 【size_t是无符号整数 (-1 > 10) -> 1】
- 【MySQL】mysql因为字符集导致left join出现Using join buffer (Block Nested Loop)
猜你喜欢
【ASM】字节码操作 MethodVisitor 案例实战 生成对象
Tom Morgan | Twenty-One Rules of Life
【八大排序①】插入排序(直接插入排序、希尔排序)
Attentional Feature Fusion
拿下跨界C1轮投资,本土Tier 1高阶智能驾驶系统迅速“出圈”
循环嵌套以及列表的基本操作
安装torch_sparse失败解决方法
Quick sort eight sorts (3) 】 【 (dynamic figure deduction Hoare, digging holes, front and rear pointer method)
3D打印了这个杜邦线理线神器,从此桌面再也不乱了
OSCS开源软件安全周报,一分钟了解本周开源软件安全大事
随机推荐
Go-goroutine 的那些事
Battery modeling, analysis and optimization (Matlab code implementation)
记录一次被入侵5900端口经历
6.Map interface and implementation class
基于信号量与环形队列实现读写异步缓存队列
Win系统 - 罗技 G604 鼠标蓝灯闪烁、失灵解决方案
Go-指针的那些事
喜迎排名18
[Machine Learning] Basics of Data Science - Basic Practice of Machine Learning (2)
LPP code and its comments
动态内存管理
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
主从postition变化无法锁定_Slave_IO_Running显示No_Slave_Sql_Running显示No---Mysql主从复制同步002
Secretive present: in modern times
集合与函数
BlockingQueue理论普
Openwrt配置Aria2(Hg255d)
mysql 修改密码和忘记密码操作
The GNU Privacy Guard
多线程案例——定时器