当前位置:网站首页>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)
边栏推荐
- Luo Gu - some interesting questions 2
- LVGL 8.2 text shadow
- Introduction to asynchronous task capability of function calculation - task trigger de duplication
- Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow
- Helix Swarm中文包发布,Perforce进一步提升中国用户体验
- LVGL 8.2 LED
- 【学习笔记】拟阵
- TechSmith Camtasia studio 2022.0.2 screen recording software
- %s格式符
- Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
猜你喜欢
内存管理总结
flutter 报错 No MediaQuery widget ancestor found.
Node mongodb installation
Programmers exposed that they took private jobs: they took more than 30 orders in 10 months, with a net income of 400000
Luo Gu - some interesting questions 2
10. (map data) offline terrain data processing (for cesium)
Gin integrated Alipay payment
[local differential privacy and random response code implementation] differential privacy code implementation series (13)
Ranking list of databases in July: mongodb and Oracle scores fell the most
Introduction to asynchronous task capability of function calculation - task trigger de duplication
随机推荐
First experience of ViewModel
Summary of common problems in development
Ranking list of databases in July: mongodb and Oracle scores fell the most
Optimization method of deep learning neural network
产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
LeetCode 1200 最小绝对差[排序] HERODING的LeetCode之路
曝光一下阿里的工资待遇和职位级别
flutter 报错 No MediaQuery widget ancestor found.
Leetcode 1200 minimum absolute difference [sort] The Path of leetcode for heroding
LVGL 8.2 Line wrap, recoloring and scrolling
No servers available for service: xxxx
UFO: Microsoft scholars have proposed a unified transformer for visual language representation learning to achieve SOTA performance on multiple multimodal tasks
LVGL 8.2 Sorting a List using up and down buttons
Redis publier et s'abonner
(1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!
Wt588f02b-8s (c006_03) single chip voice IC scheme enables smart doorbell design to reduce cost and increase efficiency
【学习笔记】拟阵
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
Gin integrated Alipay payment
IO flow: node flow and processing flow are summarized in detail.