当前位置:网站首页>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)
边栏推荐
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- Why do domestic mobile phone users choose iPhone when changing a mobile phone?
- Red envelope activity design in e-commerce system
- LVLG 8.2 circular scrolling animation of a label
- LVGL 8.2 Line wrap, recoloring and scrolling
- Dialogue with ye Yanxiu, senior consultant of Longzhi and atlassian certification expert: where should Chinese users go when atlassian products enter the post server era?
- Guitar Pro 8win10 latest guitar learning / score / creation
- Programmer turns direction
- 如何配和弦
- 03 storage system
猜你喜欢
如何搭建一支搞垮公司的技术团队?
如何配和弦
LVGL 8.2 Draw label with gradient color
LVGL 8.2 Line wrap, recoloring and scrolling
Summary of common problems in development
现代控制理论入门+理解
Flutter reports an error no mediaquery widget ancestor found
Five minutes per day machine learning: use gradient descent to complete the fitting of multi feature linear regression model
Xcode abnormal pictures cause IPA packet size problems
UFO: Microsoft scholars have proposed a unified transformer for visual language representation learning to achieve SOTA performance on multiple multimodal tasks
随机推荐
微博、虎牙挺进兴趣社区:同行不同路
Deep learning neural network case (handwritten digit recognition)
Graduation season - personal summary
PLC模拟量输入 模拟量转换FC S_ITR (CODESYS平台)
Memory management summary
Partial modification - progressive development
【C语言】指针笔试题
%s格式符
What are the concepts of union, intersection, difference and complement?
LVGL 8.2 Menu
A collection of classic papers on convolutional neural networks (deep learning classification)
Deep learning network regularization
Expose Ali's salary and position level
Ranking list of databases in July: mongodb and Oracle scores fell the most
Analysis of nearly 100 million dollars stolen and horizon cross chain bridge attacked
[differential privacy and data adaptability] differential privacy code implementation series (XIV)
C language personal address book management system
(1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!
Ali was laid off employees, looking for a job n day, headhunters came bad news
03-存储系统