当前位置:网站首页>Halcon knowledge: NCC_ Model template matching
Halcon knowledge: NCC_ Model template matching
2022-07-04 14:59:00 【Mr anhydrous】
explain
In addition to common template matching , There are other templates matching , Although not mainstream , But try to use , It can also solve many problems . Let's start with ncc_model Templates .
One 、 Based on cross-correlation matching
A method based on gray value is based on correlation matching . This method uses normalized cross-correlation , Used to evaluate the correspondence between the model and the search image . It is significantly faster than the classic gray value based matching , And it can compensate for the multiplicative changes of addition and illumination . Contrary to shape based matching , Objects also have slightly changed shapes 、 Objects in a large number of textured or blurred images ( The outline disappears in the blur image , for example , Because of defocus ) Can find . applications : The search object has slight deformation , Lots of textures , Image blur and other occasions , Fast , Low precision . Basic operation :
1. Create cross-correlation templates :create_ncc_model()
2. Look for correlations :find_ncc_model()
3. Release template :clear_ncc_model()
In this section , We will quickly outline the matching process based on correlation matching . To actively follow the example , start-up HDevelop Program hdevelop\Matching\Correlation-Based\ find_ncc_model_defocused.hdev, It shows the robustness against texture and defocus based on correlation matching .
dev_update_off ()
read_image (Image, 'smd/smd_on_chip_05')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_color ('green')
dev_set_draw ('margin')
gen_rectangle1 (Rectangle, 175, 156, 440, 460)
area_center (Rectangle, Area, RowRef, ColumnRef)
reduce_domain (Image, Rectangle, ImageReduced)
create_ncc_model (ImageReduced, 'auto', 0, 0, 'auto', 'use_polarity', ModelID)
dev_display (Image)
dev_display (Rectangle)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
for J := 1 to 11 by 1
read_image (Image, 'smd/smd_on_chip_' + J$'02')
find_ncc_model (Image, ModelID, 0, 0, 0.5, 1, 0.5, 'true', 0, Row, Column, Angle, Score)
vector_angle_to_rigid (RowRef, ColumnRef, 0, Row, Column, 0, HomMat2D)
affine_trans_region (Rectangle, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
dev_display (Image)
dev_display (RegionAffineTrans)
if (J < 11)
disp_continue_message (WindowHandle, 'black', 'true')
endif
stop ()
endfor
clear_ncc_model (ModelID)Two 、 Brief description of the procedure
step 1: Select the object in the reference image
First , In the training image , Use gen_rectangle1 Create an area containing objects . This use area_center Query the center of the area . In the following steps, you will need to cover the matching between the result and the original area . then , Reduce the image to the area of interest .
read_image (Image, 'smd/smd_on_chip_05')
gen_rectangle1 (Rectangle, 175, 156, 440, 460)
area_center (Rectangle, Area, RowRef, ColumnRef)
reduce_domain (Image, Rectangle, ImageReduced)
step 2: Creating models
The reduced image is used to pass create_ncc_model establish NCC Model . result , Operator returns the newly created model (ModelID) The handle of , It can then be used to specify the model , for example , When calling the operator find_ncc_model when .
create_ncc_model (ImageReduced, 'auto', 0, 0, 'auto', 'use_polarity', ModelID)
step 3: Find the object again
Now? , Cycle through the image , And search based on the above template , For each search image , Search for NCC Model and use affine transformation to cover the model area . Please note that , Training is applied to focused images , The search is applied to defocus of image changes with the following characteristics . For all that , Object instances have been found . chart 3.1 It shows the reference image and one of the model examples that are defocused but found .
for J := 1 to 11 by 1
read_image (Image, 'smd/smd_on_chip_' + J$'02')
find_ncc_model (Image, ModelID, 0, 0, 0.5, 1, 0.5, 'true', 0, Row, \
Column, Angle, Score)
vector_angle_to_rigid (RowRef, ColumnRef, 0, Row, Column, 0, HomMat2D)
affine_trans_region (Rectangle, RegionAffineTrans, HomMat2D, \
'nearest_neighbor')
dev_display (Image)
dev_display (RegionAffineTrans)
endfor

step 4: Destroy the model
When there is no need for NCC Model time , Use clear_ncc_model Destroy it .clear_ncc_model (ModelID)
边栏推荐
- Node mongodb installation
- LVGL 8.2 text shadow
- Yyds dry goods inventory # solve the real problem of famous enterprises: continuous maximum sum
- Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow
- Exploration and practice of eventbridge in the field of SaaS enterprise integration
- 小数,指数
- LVGL 8.2 Line
- Summary of common problems in development
- Who the final say whether the product is good or not? Sonar puts forward performance indicators for analysis to help you easily judge product performance and performance
- 深度学习7 Transformer系列实例分割Mask2Former
猜你喜欢

Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow

Kubernets Pod 存在 Finalizers 一直处于 Terminating 状态
![[information retrieval] experiment of classification and clustering](/img/05/ee3b3bc4ab79d52b63cdc34305aa57.png)
[information retrieval] experiment of classification and clustering

Alcohol driving monitoring system based on stm32+ Huawei cloud IOT design

为什么国产手机用户换下一部手机时,都选择了iPhone?

How to handle exceptions in multithreading?

阿里被裁员工,找工作第N天,猎头又传来噩耗...

Preliminary exploration of flask: WSGI

10. (map data) offline terrain data processing (for cesium)

LVGL 8.2 Draw label with gradient color
随机推荐
Wt588f02b-8s (c006_03) single chip voice IC scheme enables smart doorbell design to reduce cost and increase efficiency
金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
PLC Analog input analog conversion FC s_ ITR (CoDeSys platform)
How to handle exceptions in multithreading?
Redis publish and subscribe
Explain of SQL optimization
如何配和弦
LVLG 8.2 circular scrolling animation of a label
Ffprobe common commands
Red envelope activity design in e-commerce system
EventBridge 在 SaaS 企业集成领域的探索与实践
Analysis of nearly 100 million dollars stolen and horizon cross chain bridge attacked
[information retrieval] experiment of classification and clustering
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
Deep learning neural network case (handwritten digit recognition)
Flutter reports an error no mediaquery widget ancestor found
SAIC Maxus officially released its new brand "mifa", and its flagship product mifa 9 was officially unveiled!
selenium 元素交互
都在说DevOps,你真正了解它吗?
LVGL 8.2 Menu