当前位置:网站首页>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
边栏推荐
- 运算符重载的初识
- org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
- When facing the industrial Internet, they even use the ways and methods of consuming the Internet to land and practice the industrial Internet
- Calculate special bonus
- Ks009 implementation of pet management system based on SSH
- What are the preferential activities for stock account opening? In addition, is it safe to open a mobile account?
- The latest CSDN salary increase technology stack in 2022 overview of APP automated testing
- What are the applications of SMS in enterprises?
- PHP通过第三方插件爬取数据
- PHP crawls data through third-party plug-ins
猜你喜欢

CorelDRAW 2022 Chinese Simplified 64 bit direct download

For the sustainable development of software testing, we must learn to knock code?

The whole process of AS400 API from zero to one

PHP通过第三方插件爬取数据

Ks009 implementation of pet management system based on SSH

halcon变量窗口的图像变量不显示,重启软件和电脑都没用

哪有什么未来可期,不过是打工人临死前最后的幻想罢了

7-2 拼题A打卡奖励 dp

数学知识:求组合数 III—求组合数
![Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]
随机推荐
P6773 [noi2020] destiny (DP, segment tree merging)
Do you write API documents or code first?
What is the difference between port number and process number?
Last day of the second quarter
Live shopping mall source code, realize left-right linkage of commodity classification pages
Clickhouse 消除由group by产生的间隙
(总结一)Halcon基础之寻找目标特征+转正
The personal test is effective, and the JMeter desktop shortcut is quickly created
软件开发中的上游和下游
FL Studio20.9水果软件高级中文版电音编曲
C#生成putty格式的ppk文件(支持passphrase)
【毕业季·进击的技术er】--毕业到工作小结
QT web 开发 - video -- 笔记
MySQL insert \ pre update + judgment condition
P6773 [NOI2020] 命运(dp、线段树合并)
Int and bit group turn to each other
SWT/ANR问题--StorageManagerService卡住
修复表中的名字(首字符大写,其他小写)
[proteus simulation] Arduino UNO +74c922 keyboard decoding drive 4x4 matrix keyboard
股票开户有哪些优惠活动?另外,手机开户安全么?