当前位置:网站首页>Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
2022-07-05 07:55:00 【BoomBiuBiu】
* The purpose of this example is to check ncc Detected deviation , When the focus of the lens changes , The results of its reference model ;
* Iterate over the sequence . The matching scheme used here is ncc Model . The detected model is x and y The overall movement in the direction ;
* Last ( In pixels ) Described
dev_close_window ()
read_image (ImageRef, 'pcb_focus/pcb_focus_telecentric_061')
get_image_size (ImageRef, Width, Height)
dev_open_window_fit_image (ImageRef, 0, 0, -1, -1, WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_update_off ()
dev_set_draw ('margin')
dev_set_color ('green')
dev_set_line_width (1)
*
** establish ncc Model
gen_rectangle1 (ModelRegion, 81.5, 148.5, 419.5, 633.5)
reduce_domain (ImageRef, ModelRegion, TemplateImage)
dev_clear_window ()
dev_display (TemplateImage)
disp_message (WindowHandle, 'Creating the ncc model may take a few seconds ... ', 'window', 12, 12, 'black', 'true')
create_ncc_model (TemplateImage, 'auto', -rad(5), rad(10), 'auto', 'use_polarity', ModelID)
* Disable automatic window refresh for flicker free display
* Whether to refresh the window after displaying each object . If the value is set to false, Must call FlushBuffer Function refresh window .
set_window_param (WindowHandle, 'flush', 'false')
* Find... In the image ncc Model
area_center (ModelRegion, Area, ModelRow, ModelColumn)
Rows := []
Columns := []
for Index := 1 to 121 by 1
read_image (Image, 'pcb_focus/pcb_focus_telecentric_' + Index$'03' + '.png')
find_ncc_model (Image, ModelID, -rad(5), rad(10), 0.5, 1, 0.5, 'true', 0, Row, Column, Angle, Score)
Rows := [Rows,Row]
Columns := [Columns,Column]
dev_display (Image)
* Show matching results
dev_display_ncc_matching_results (ModelID, 'green', Row, Column, Angle, 0)
disp_message (WindowHandle, 'Finding ncc model in image: ' + Index$'03', 'window', 12, 12, 'white', 'false')
* Refresh the contents of the window .
flush_buffer (WindowHandle)
endfor
* If you need to interact with the window ( Zoom and drag ), The value must be set to true
set_window_param (WindowHandle, 'flush', 'true')
dev_display (Image)
wait_seconds (1)
gen_contour_polygon_xld (Contour, Rows, Columns)
* Approximate by line segment XLD outline .
* Fit a straight line
fit_line_contour_xld (Contour, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
gen_contour_polygon_xld (Regression, [RowBegin,RowEnd], [ColBegin,ColEnd])
* Resize window , Make pixels appear square
Ratio := (394 - 389 + 1) / real(252 - 250 + 1)
dev_resize_window_fit_size (0, 0, Height * Ratio, Height, 640, 480)
dev_set_part (250, 389, 252, 394)
dev_display (ImageRef)
dev_set_color ('green')
dev_display (Contour)
dev_set_color ('yellow')
dev_display (Regression)
disp_message (WindowHandle, ['Deviation of ncc matches in (x,y)-direction','while defocusing lens'], 'image', 249.75, 389, 'white', 'false')
disp_message (WindowHandle, ' Deviation (green), Tukey\'s robust regression (yellow) in pixel', 'image', 251.75, 389.25, 'white', 'false')
* Close all handles
clear_ncc_model (ModelID)
边栏推荐
- mysql 盲注常见函数
- 1089 Insert or Merge 含测试点5
- UEFI development learning 4 - getting to know variable services
- assert_ Usage of param function
- Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
- Global and Chinese market of peeled bourdon tubes 2022-2028: Research Report on technology, participants, trends, market size and share
- Global and Chinese market of plastic recycling machines 2022-2028: Research Report on technology, participants, trends, market size and share
- String judgment
- solver. Learning notes of prototxt file parameters
- Altium designer 19.1.18 - clear information generated by measuring distance
猜你喜欢

Package ‘*****‘ has no installation candidate

High end electronic chips help upgrade traditional oil particle monitoring

How to select conductive slip ring

Train your dataset with yolov4

Realization of binary relation of discrete mathematics with C language and its properties

Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world

Extended application of single chip microcomputer-06 independent key

Embedded AI intelligent technology liquid particle counter

Altium designer 19.1.18 - hide the fly line of a network

如何进行导电滑环选型
随机推荐
Altium designer 19.1.18 - hide the fly line of a network
Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
Function and usage of function pointer
Network communication process
Altium Designer 19.1.18 - 隐藏某一个网络的飞线
Programming knowledge -- basis of C language
Altium designer 19.1.18 - Import frame
The global and Chinese market of lithographic labels 2022-2028: Research Report on technology, participants, trends, market size and share
C language enhancement -- pointer
Global and Chinese market of rammers 2022-2028: Research Report on technology, participants, trends, market size and share
L'étude a révélé que le système de service à la clientèle du commerce électronique transfrontalier a ces cinq fonctions!
NSIS search folder
Baiwen 7-day smart home learning experience of Internet of things
Altium designer 19.1.18 - clear information generated by measuring distance
Global and Chinese market of quenching furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for medical oxygen machines 2022-2028: Research Report on technology, participants, trends, market size and share
UEFI development learning 4 - getting to know variable services
LED display equipment records of the opening ceremony of the Beijing Winter Olympics
solver. Learning notes of prototxt file parameters