当前位置:网站首页>halcon之区域:多种区域(Region)生成(4)
halcon之区域:多种区域(Region)生成(4)
2022-06-25 23:18:00 【无水先生】
一、提要
某些区域生成概念很多,初学者往往不得要领,如果不系统地学一下,几年下来,思想依然模糊,做项目感觉到“书到用时方恨少”,本篇是前几篇的后续,目的在于全面系统地渗透,达水滴石穿之功效。
二、基于区域的算子
2.1 轮廓线的点获取
算子:get_region_contour(region, Rows, Columns)
获取已知区域region的散点,保存在Rows, Columns内。
read_image (Image, 'f:/images/DOTS/block.jpg')
rgb1_to_gray(Image,gray)
get_image_size(gray,width,height)
* gen_rectangle1(rect,0,0,height,width)
fast_threshold (gray,rect,0, 50 , 7)
* get_region_chain(rect, Row, Column, Chain)
get_region_contour(rect, Rows, Columns)
gen_image_const(BlkImage,'byte',width,height)
for I:=0 to |Rows|-1 by 1
tmpRow:=Rows[I]
tmpClm:=Columns[I]
set_grayval(BlkImage, tmpRow, tmpClm, 228)
endfor
dev_display(BlkImage)
2.2.获取线段区域
gen_region_line(regline,row1,col1,row2,col2)
获取一条线段的区域,注意,regline是个区域,不是像素列表;若要获取散列点需要如下步骤:
gen_region_line(RegionLines, 100, 50, 150, 250)
get_region_points(RegionLines, Rows, Columns)
2.3 获取区域的像素元组(见上小节)
gen_region_points(regin,rows,cos)
功能:将个别的像素存储为图像区域。
2.4 生成多边形
gen_region_polygon
功能:将一个多边形存储为一个区域。
gen_image_const(BlkImage,'byte',width,height)
gen_region_polygon(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
2.5 生成多边形实心
gen_region_polygon_filled(region,rows,cols)
功能:将一个多边形存储为一个已填充区域。
gen_image_const(BlkImage,'byte',width,height)
gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
2.6 从区域获取xld
gen_contour_region_xld (reg, Contours, 'border')
reg是输入区域,Contours是得到的xld对象。
gen_image_const(BlkImage,'byte',width,height)
gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
gen_image_const(xldImage,'byte',width,height)
gen_contour_region_xld (reg, Contours, 'border')
2.6. 生成多边形区域
gen_region_polygon_xld
功能:创建一个XLD多边形中的区域。
以下代码生成外轮廓的region边缘。
gen_image_const(BlkImage,'byte',width,height)
gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
gen_image_const(xldImage,'byte',width,height)
gen_contour_region_xld (reg, Contours, 'border')
gen_polygons_xld(Contours,Polygons , 'ramer', 1 )
gen_region_polygon_xld( Polygons,Region, 'margin')
2.7.生成区域扫描线
gen_region_runs
功能:创建一个扫描宽度编码中的图像区域。
2.8. 标注相同灰度的区域
label_to_region
功能:提取一幅图像中灰度值相同的区域。
边栏推荐
- Simple deepclone
- A sharp tool for information collection, Google hacker syntax
- 从查询数据库性能优化谈到redis缓存-谈一谈缓存的穿透、雪崩、击穿
- Modelsim simulation FFT core cannot be simulated solution (qsys)
- ADC acquisition noise and comparison between RMS filter and Kalman filter
- Blob
- FreeRTOS+STM32L+ESP8266+MQTT协议传输温湿度数据到腾讯云物联网平台
- PHP performance optimization
- Electronic training.
- Data analysis slicer, PivotTable and PivotChart (necessary in the workplace)
猜你喜欢
随机推荐
[learn FPGA programming from scratch -44]: vision chapter - integrated circuit helps high-quality development in the digital era -1- main forms of integrated circuit chips
Data synchronization
开窍之问答
Redis的安装及启动
Installation and startup of redis
Unknown device ID does not appear on the STM32 st-link utility connection! Causes and Solutions
Post ordered clue binary tree
如何有效地推廣產品
使用Gin框架运行Demo时报错“ listen tcp :8080: bind: An attempt was made to access a socket in a way forbidden”
Establish a j-link GDB cross debugging environment for Px4
模板引擎——FreeMarker初体验
mysql错误代码2003的解决办法
卡通shader
ASP.NET cache缓存的用法
Msp430f5529lp official board (red) can not debug the problem
Vscode shortcut
Balanced binary tree AVL
Blob
Endnote IEEE Transactions on industrial electronics/tie/tpel reference format template
信息收集的利器,Google骇客语法