当前位置:网站首页>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)
边栏推荐
- LVGL 8.2 List
- TechSmith Camtasia studio 2022.0.2 screen recording software
- LVGL 8.2 keyboard
- Xcode abnormal pictures cause IPA packet size problems
- 深度学习 神经网络的优化方法
- 金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
- 5G电视难成竞争优势,视频资源成中国广电最后武器
- Is BigDecimal safe to calculate the amount? Look at these five pits~~
- 程序员自曝接私活:10个月时间接了30多个单子,纯收入40万
- Comment configurer un accord
猜你喜欢

Xcode abnormal pictures cause IPA packet size problems

Helix Swarm中文包发布,Perforce进一步提升中国用户体验

Memory management summary

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

5G电视难成竞争优势,视频资源成中国广电最后武器

LVGL 8.2 Line

Node mongodb installation

Weibo and Huya advance into interest communities: different paths for peers

【C语言】指针笔试题

MP3是如何诞生的?
随机推荐
Comment configurer un accord
Preliminary exploration of flask: WSGI
Redis 发布和订阅
C language achievement management system for middle school students
Free, easy-to-use, powerful lightweight note taking software evaluation: drafts, apple memo, flomo, keep, flowus, agenda, sidenote, workflow
Analysis of nearly 100 million dollars stolen and horizon cross chain bridge attacked
[local differential privacy and random response code implementation] differential privacy code implementation series (13)
Five minutes per day machine learning: use gradient descent to complete the fitting of multi feature linear regression model
They are all talking about Devops. Do you really understand it?
函数计算异步任务能力介绍 - 任务触发去重
PLC模拟量输入 模拟量转换FC S_ITR (CODESYS平台)
十六进制
Helix swarm Chinese package is released, and perforce further improves the user experience in China
[information retrieval] experiment of classification and clustering
Five minutes of machine learning every day: why do we need to normalize the characteristics of numerical types?
Xcode abnormal pictures cause IPA packet size problems
5G电视难成竞争优势,视频资源成中国广电最后武器
flutter 报错 No MediaQuery widget ancestor found.
Opencv learning notes - linear filtering: box filtering, mean filtering, Gaussian filtering
炒股网上开户安全吗?会不会被骗。