当前位置:网站首页>Halcon blob analysis (ball.hdev)
Halcon blob analysis (ball.hdev)
2022-07-05 08:40:00 【Aii parson】
* ball.hdev: Inspection of Ball Bonding
*
dev_update_window ('off')# Stop updating the form
dev_close_window ()# Closing Windows
dev_open_window (0, 0, 728, 512, 'black', WindowID)# create a window , And specify the handle
read_image (Bond, 'die/die_03')
dev_display (Bond)
set_display_font (WindowID, 14, 'mono', 'true', 'false')
disp_continue_message (WindowID, 'black', 'true')
stop ()
threshold (Bond, Bright, 100, 255)# Two valued , Gray histogram tool
shape_trans (Bright, Die, 'rectangle2')# Shape change , Obtain the minimum circumscribed rectangle of the connected domain of a binary graph
dev_set_color ('green')
dev_set_line_width (3)
dev_set_draw ('margin')# Show edges
dev_display (Die)
disp_continue_message (WindowID, 'black', 'true')
stop ()
reduce_domain (Bond, Die, DieGrey)# Reduced area ( get ROI), amount to Intercept the main parts that need to be studied . Reduce the definition domain of the given image to the specified new area , Does not reduce the actual size of the image , The new area must be a sub area of the original area
threshold (DieGrey, Wires, 0, 50)
fill_up_shape (Wires, WiresFilled, 'area', 1, 100)
dev_display (Bond)
dev_set_draw ('fill')# Show fill
dev_set_color ('red')
dev_display (WiresFilled)
disp_continue_message (WindowID, 'black', 'true')
stop ()
opening_circle (WiresFilled, Balls, 15.5)# Reduce pixels , Remove isolated dots 、 Burr and bridge ;Circle It has the greatest effect on the circle .
dev_set_color ('green')
dev_display (Balls)
disp_continue_message (WindowID, 'black', 'true')
stop ()
connection (Balls, SingleBalls)# Disconnect connected domain
select_shape (SingleBalls, IntermediateBalls, 'circularity', 'and', 0.85, 1.0)# Select the target circle through roundness
// The sorting step can be omitted , Unless you need to display the parameters of some targets ( If only the 2-3 The circumscribed circle diameter of )
sort_region (IntermediateBalls, FinalBalls, 'first_point', 'true', 'column')# Sort area , Sort by column , First ascending from the left
dev_display (Bond)
dev_set_colored (12)
dev_display (FinalBalls)
disp_continue_message (WindowID, 'black', 'true')
stop ()
smallest_circle (FinalBalls, Row, Column, Radius)# Obtain the minimum circumscribed circle parameter of each region
NumBalls := |Radius|
Diameter := 2 * Radius
meanDiameter := mean(Diameter)# Omission ( Not quoted later )
minDiameter := min(Diameter)# Omission
dev_display (Bond)# Show the original
disp_circle (WindowID, Row, Column, Radius)# Display circle
dev_set_color ('white')
disp_message (WindowID, 'D: ' + Diameter$'.4', 'image', Row - 2 * Radius, Column, 'white', 'false')# Use image coordinates to display “ The diameter of ” Information
dev_update_window ('on')# Update Form
边栏推荐
猜你喜欢
Guess riddles (6)
Example 003: a complete square is an integer. It is a complete square after adding 100, and it is a complete square after adding 168. What is the number?
Pytorch entry record
How to manage the performance of R & D team?
319. Bulb switch
剑指 Offer 06. 从尾到头打印链表
Guess riddles (4)
How to write cover letter?
猜谜语啦(3)
99 multiplication table (C language)
随机推荐
Example 008: 99 multiplication table
Arrangement of some library files
如何写Cover Letter?
Explore the authentication mechanism of StarUML
Array integration initialization (C language)
Esphone retrofits old fans
Example 001: the number combination has four numbers: 1, 2, 3, 4. How many three digits can be formed that are different from each other and have no duplicate numbers? How many are each?
Bluebridge cup internet of things competition basic graphic tutorial - clock selection
Infix expression evaluation
Sword finger offer 09 Implementing queues with two stacks
U8g2 drawing
Bluebridge cup internet of things basic graphic tutorial - GPIO output control LD5 on and off
Sword finger offer 05 Replace spaces
[matlab] matlab reads and writes Excel
【三层架构】
Digital analog 1: linear programming
287. 寻找重复数-快慢指针
实例008:九九乘法表
Stm32--- systick timer
Example 002: the bonus paid by the "individual income tax calculation" enterprise is based on the profit commission. When the profit (I) is less than or equal to 100000 yuan, the bonus can be increase