当前位置:网站首页>Some uses of Halcon array
Some uses of Halcon array
2022-07-01 02:04:00 【The little girl is so cute】
halcon Some uses of arrays
There's nothing to talk about , I won't explain things that are not part of the array here .
area_center(RegionOpening,Area, Row, Column). Use area_center To find the center and area of a region , return Area, Row, Column These three parameters . When the number of regions is greater than 1 when ,Area, Row, Column It's all an array
Back to Area, Row, Column These three arrays ,Area It is sorted according to the area from small to small ,Row and Column It's corresponding to Area The center of the area , namely Row and Column The first element of is the central coordinate of the area with the smallest area- tuple_sort_index(Column,Sorted_Column): Yes Column Sort ( From small to large ), The index of the sorted element is returned . for example Column yes 【300,200, 100】, Back to Sorted_Column=【2,1,0】
- new_row := Row[Sorted_Column]: Give Way Row With Sorted_Column Sort in a different way , Then assign the value to new_row. for example Row=【20, 10, 50】,Sorted_Column=【2,1,0】-----> Row[Sorted_Column] = 【50,10,20】
- Halcon The array in can only be 1xN Array of , That is, arrays cannot be nested in an array
read_image(Image, 'printer_chip/printer_chip_01')
* Display images
* Open a file of size 512,512 The window of
dev_open_window(0, 0, 512, 512, 'black', WindowHandle)
dev_display(Image)
* Draw a rectangle on the window ROT Area
draw_rectangle1(WindowHandle, Row1, Column1, Row2, Column2)
* Make rectangle ROI Area
gen_rectangle1(Rectangle_Roi, Row1, Column1, Row2, Column2)
* Process the pictures , Leave only ROI Image of the area , The rest turned black
reduce_domain(Image, Rectangle_Roi, ImageReduced)
* Average filter the image ,10,10 yes kernel Size
mean_image(ImageReduced, ImageMean, 10, 10)
* Calculate the difference between the original image and the image after the average value , If the difference exceeds 5 The retention
dyn_threshold(ImageReduced, ImageMean, RegionDynThresh, 5, 'dark')
* Break up the area
connection(RegionDynThresh, ConnectedRegions)
* Use area to filter
select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 4000, 99999)
* Fill the area
fill_up(SelectedRegions, RegionFillUp)
* Use a size of 50*50 To perform the open operation , I can put it down 50*50 The region of the matrix is reserved , Those that cannot be put down will be eliminated
opening_rectangle1(RegionFillUp, RegionOpening, 50, 50)
* Count the number of areas
count_obj(RegionOpening, Number)
* Find the center and area of each region , When the number of regions is greater than 1 when ,Area, Row, Column It's all an array
area_center(RegionOpening,Area, Row, Column)
* Because the areas are all on the same horizontal line , So according to column To sort , From small to large . What is returned is after sorting index Array of
tuple_sort_index(Column,Sorted_Column)
*halcon Array operations in , Is to put Row and Column The elements of are sorted according to the above sorting method
new_row := Row[Sorted_Column]
new_column := Column[Sorted_Column]
* Create an array to count the distance between two adjacent areas
distance_list := []
* Use for Loop to traverse , Calculate the distance between the current area and the next area
for j := 0 to Number-1 by 1
* Draw the center of the area
gen_circle(Circle, new_row[j], new_column[j], 10)
* Because the center of each area should be depicted here , therefore j be equal to Number-1 Also draw the center
* but j be equal to Number-1 The distance is not calculated , because Number-1 It's the last area , No other area can calculate the distance with him
* So use break Out of the loop
if (j == Number-1)
break
endif
* Formula for calculating the distance between points ,new_row[j], new_column[j] Is the coordinate of the first point
distance_pp(new_row[j], new_column[j], new_row[j+1], new_column[j+1], Distance)
* Put the distance between two local areas into the array . Explain in halcon Array can only be 1xN Array of , You cannot set an array inside an array
distance_list[j] := Distance
endfor
边栏推荐
- opencv -- 笔记
- Check the disk usage of MySQL database
- What is the difference between port number and process number?
- AS400 大廠面試
- SQL语句关联表 如何添加关联表的条件 [需要null值或不需要null值]
- How to maintain efficient collaboration in remote office and achieve stable growth of projects | community essay solicitation
- There is no future to be expected. It is just the last fantasy of a migrant worker before he dies
- Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
- How to learn and read code
- Leetcode(524)——通过删除字母匹配到字典里最长单词
猜你喜欢
Short message sending solution in medical his industry
FL studio20.9 fruit software advanced Chinese edition electronic music arrangement
AS400 API 从零到一的整个历程
QML控件类型:ToolTip
There is no future to be expected. It is just the last fantasy of a migrant worker before he dies
3500 word summary: a complete set of skills that a qualified software testing engineer needs to master
[fundamentals of wireless communication-15]: illustrated mobile communication technology and application development-3-overview of digital communication 2G GSM, CDMA, 3G wdcma/cdma200/td-scdma, 4G LTE
修复表中的名字(首字符大写,其他小写)
With regard to the white box test, you have to master these skills~
Electron pit Addon
随机推荐
修复表中的名字(首字符大写,其他小写)
electron之坑addon
PHP converts two-dimensional array elements into key value pairs
C#生成putty格式的ppk文件(支持passphrase)
Fast understanding of forward proxy and reverse proxy
Alphabet-Rearrange-Inator 3000(字典树自定义排序)
如何选择券商?另外,手机开户安全么?
org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
Objects and object variables
go导入自建包
数学知识:满足条件的01序列—求组合数
删除重复的电子邮箱
With one-stop insight into industry hot spots, the new function "traffic market" of feigua data station B is launched!
Log4j2 ThreadContext日志链路追踪
halcon变量窗口的图像变量不显示,重启软件和电脑都没用
Int and bit group turn to each other
【agora】用户管理
Test essential tool - postman practical tutorial
小程序云开发之--微信公众号文章采集篇
7-2 拼题A打卡奖励 dp