当前位置:网站首页>Halcon 距离计算
Halcon 距离计算
2022-07-16 09:05:00 【廷益--飞鸟】

read_image (Image, './img.png')
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_set_line_width (3)
dev_display (Image)
set_display_font (WindowHandle, 20, 'mono', 'true', 'false')
* ------- 1.点与点的距离 -----------------------
* draw_point (WindowHandle, PointRow1, PointColumn1)
PointRow1 := 100
PointColumn1 := 210
PointRow2 := 150
PointColumn2 := 410
gen_cross_contour_xld (CrossP1, PointRow1, PointColumn1, 30, 0.785398)
gen_cross_contour_xld (CrossP2, PointRow2, PointColumn2, 30, 0.785398)
gen_contour_polygon_xld (RegionLines, [PointRow1,PointRow2], [PointColumn1, PointColumn2])
* gen_region_line (RegionLines, PointRow1, PointColumn1, PointRow2, PointColumn2)
distance_pp (PointRow1, PointColumn1, PointRow2, PointColumn2, Distance)
dev_display (Image)
dev_display (CrossP1)
dev_display (CrossP2)
dev_display (RegionLines)
disp_message (WindowHandle, Distance, 'window', 12, 12, 'black', 'true')
stop()
* ------- 2.点与线的距离 -----------------------
* draw_line (WindowHandle, LineRow1, LineColumn1, LineRow2, LineColumn2)
LineRow1:= 329.0
LineColumn1:= 119.0
LineRow2:= 103.5
LineColumn2:= 46.5
gen_contour_polygon_xld (RegionLines1, [LineRow1,LineRow2], [LineColumn1,LineColumn2])
* gen_region_line (RegionLines1, LineRow1, LineColumn1, LineRow2, LineColumn2)
* 距离计算
distance_pl (PointRow1, PointColumn1, LineRow1, LineColumn1, LineRow2, LineColumn2, DistancePL)
* 垂足点计算
projection_pl (PointRow1, PointColumn1, LineRow1, LineColumn1, LineRow2, LineColumn2, RowProj, ColProj)
gen_contour_polygon_xld (RegionLines2, [PointRow1,RowProj], [PointColumn1,ColProj])
dev_display (Image)
dev_display (CrossP1)
dev_display (RegionLines1)
dev_display (RegionLines2)
disp_message (WindowHandle, DistancePL, 'window', 12, 12, 'black', 'true')
stop()
* ------- 3.点与区域的距离 -----------------------
gen_region_polygon (Region, [66, 110, 120, 100,24, 66], [466,450,529,606,509, 466])
fill_up (Region, RegionFillUp)
distance_pr (RegionFillUp, PointRow1, PointColumn1, DistanceMin, DistanceMax)
gen_contour_region_xld (RegionFillUp, Contours, 'border')
gen_contour_polygon_xld (ContourPoint, [PointRow1], [PointColumn1])
distance_cc_min_points (ContourPoint, Contours, 'fast_point_to_segment', \
DistanceMin1, Row1, Column1, Row2, Column2)
gen_cross_contour_xld (Cross, Row2, Column2, 30, 0.785398)
gen_contour_polygon_xld (RegionLinesPr, [PointRow1, Row2], [PointColumn1,Column2])
dev_display (Image)
dev_display (CrossP1)
dev_display (RegionFillUp)
dev_display (Cross)
dev_display (RegionLinesPr)
disp_message (WindowHandle, DistanceMin, 'window', 12, 12, 'black', 'true')
disp_message (WindowHandle, DistanceMax, 'window', 40, 12, 'black', 'true')
stop()
* ------- 4.线与区域的距离 -----------------------
LineRow1:=250
LineColumn1:= 491
LineRow2:= 228
LineColumn2:= 639
gen_region_line (RegionLines3, LineRow1, LineColumn1, LineRow2, LineColumn2)
gen_contour_polygon_xld (ContourBaseLine, [LineRow1, LineRow2], [LineColumn1, LineColumn2])
distance_lr (RegionFillUp, LineRow1, LineColumn1, LineRow2, LineColumn2, DistanceMin2, DistanceMax1)
* ------- 5.区域与区域的距离 -----------------------
distance_rr_min (RegionFillUp, RegionLines3, MinDistance, Row11, Column11, Row21, Column21)
gen_contour_polygon_xld (ContourRR, [Row11, Row21],[Column11, Column21] )
dev_display (Image)
dev_display (RegionFillUp)
dev_display (ContourBaseLine)
dev_set_color ('blue')
dev_display (ContourRR)
disp_message (WindowHandle, MinDistance, 'window', 12, 12, 'black', 'true')
disp_message (WindowHandle, DistanceMin2, 'window', 40, 12, 'black', 'true')


边栏推荐
- Power buckle ----- gemstones and stones
- ELK集群部署(二)之部署kibana
- 社交网络的充分去中心化
- 7.14二分,LCA,差分,思维构造
- Everything about Dr. Tang: what is the real Chinese artificial heart like?
- 7.14 dichotomy, LCA, difference, thinking structure
- ValueError: The number of FixedLocator locations (7), usually from a call to set_ticks, does not mat
- NFT玩家的共识分片:金钱、社区与文化
- FPGA 20个例程篇:8.SD卡任意地址的读写
- 面试秘籍大放送,编测编学独家秘籍遭外泄?!
猜你喜欢

HCIP - PPP/HDLC与GRE/MGRE实验

Insight into the puzzle of database, 2022 Jincang innovative product launch was held

FPGA 20个例程篇:8.SD卡任意地址的读写

9. 说说hashCode() 和 equals() 之间的关系?

Everything about Dr. Tang: what is the real Chinese artificial heart like?

重邮SYDTEK实习(一): 4k和BLE profile烧录

为健康增值,为时代赋能|仙乐健康发布年度可持续发展报告

FPGA 20 routines: 8 Reading and writing of any address of SD card

剑指 Offer 10- I. 斐波那契数列(4种解法)
C语言实训通讯录(静态和动态版本)
随机推荐
Chengdu meetup | distributed database, a new engine for enterprises to reduce costs and increase efficiency
HCIP - PPP/HDLC与GRE/MGRE实验
以Celsius为反面教材,手把手教大家判断产品好坏、避开投资风险
Insight into the puzzle of database, 2022 Jincang innovative product launch was held
洞悉数据库迷局,2022金仓创新产品发布会召开
465 sword finger offer (53-i, 53-ii, 04, 50)
High resolution network (Part 2): backbone and key detector of mmpose code explanation
Elk cluster deployment (II) deployment kibana
uniapp扫码原生插件(Google MLKit、zxing;支持同时扫多个码)
二分(二分答案)问题合集
A collection of dichotomous (dichotomous answers) questions
社交网络的充分去中心化
RSS上手教程:聚合自己的信息收集渠道,RSSHub、FreshRSS、NetNewsWire
Web page making (II)
Add value to health and empower the times | xianle Health releases the annual Sustainable Development Report
FPGA 20个例程篇:8.SD卡任意地址的读写
【初始C语言】/*字符函数和字符串函数模拟实现详解*/
#kubeadm安装Kubernetes 1.15最佳实践#
Full decentralization of social networks
Elk cluster deployment (V) deployment filebeat