欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

halcon 识别遥控器显示数字

程序员文章站 2022-07-04 12:26:43
...

halcon 识别遥控器显示数字

图片是在网上找的

dev_close_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
read_image (Image, 'E:/halcon学习笔记/遥控器 温度识别/20190608130746466.png')
rgb1_to_gray (Image, GrayImage)
draw_rectangle2 (WindowHandle, Row, Column, Phi, Length1, Length2)
gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
reduce_domain (GrayImage, Rectangle, ImageReduced)
area_center (Rectangle, Area, Row1, Column1)
vector_angle_to_rigid (Row1, Column1, Phi, Row1, Column1, 0, HomMat2D)
affine_trans_region (Rectangle, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
affine_trans_image (ImageReduced, ImageAffineTrans, HomMat2D, 'constant', 'false')
reduce_domain (ImageAffineTrans, RegionAffineTrans, ImageReduced1)
threshold (ImageReduced1, Region, 100, 150)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ['rect2_len1','rect2_len2'], 'and', [19,15],[20,16] )

 sort_region (SelectedRegions, SortedRegions, 'first_point', 'true', 'column')
read_ocr_class_mlp ('Industrial_0-9_NoRej.omc', OCRHandle)
do_ocr_multi_class_mlp (SortedRegions, ImageReduced1, OCRHandle, Class, Confidence)
dev_disp_text (Class, 'window', 0, 0, 'black', [], [])

halcon 识别遥控器显示数字

相关标签: halcon