当前位置:网站首页>Halcon clolor_ pieces. Hedv: classifier_ Color recognition
Halcon clolor_ pieces. Hedv: classifier_ Color recognition
2022-07-05 08:40:00 【Aii parson】
dev_close_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
read_image (Image, 'E:/03 CV( ancient )/Halcon/ Code / Sugar bean /train.jpg')
Regions:=[' yellow ',' red ',' green ',' orange ',' background ']
gen_empty_obj (Classes)# Create an empty object , To save training samples
for i := 1 to |Regions| by 1
dev_display (Image)
dev_display (Classes)
disp_message (WindowHandle, ' Please select the specified area :', 'window', 12, 12, 'black', 'true')
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2) # Rectangular frame , You can also draw a frame of any shape
gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2)
concat_obj (Rectangle, Classes, Classes)
endfor
# Create classifier , Add data , Training data
*union1 (Classes, RegionUnion)* Not used here union1
create_class_mlp (3,7, 5, 'softmax', 'normalization', 3, 42, MLPHandle)# If it is a three channel color image , The first parameter can be set 3, The third parameter is the number of output parameters, that is Class Number of colors included , Remove the background color . The second parameter is the third parameter 2 About times .
add_samples_image_class_mlp (Image, Classes, MLPHandle)# Put the training sample Class Add to network
disp_message (WindowHandle, 'Training...', 'window', 100, 12, 'black', 'false')
train_class_mlp (MLPHandle, 400, 0.5, 0.01, Error, ErrorLog)
*test distinguish
for i := 1 to 3 by 1
read_image (Image1, 'E:/03 CV( ancient )/Halcon/ Code / Sugar bean /test0'+i)
classify_image_class_mlp (Image1, ClassRegions, MLPHandle, 0.5) # Classify and recognize objects
# Show
for Index := 1 to 5 by 1
dev_clear_window ()
copy_obj (ClassRegions, ObjectsSelected, Index, 1)# Choose one
dev_display (Image1)
dev_display (ObjectsSelected)
disp_message (WindowHandle, Regions[5-Index], 'window', 10, 10, 'black', 'true')
endfor
endfor
边栏推荐
猜你喜欢
随机推荐
整形的分类:short in long longlong
C语言标准函数scanf不安全的原因
Reasons for the insecurity of C language standard function scanf
Lori remote control LEGO motor
Sword finger offer 05 Replace spaces
Bluebridge cup internet of things competition basic graphic tutorial - clock selection
STM32 --- configuration of external interrupt
Low code platform | apaas platform construction analysis
MATLAB小技巧(28)模糊综合评价
实例010:给人看的时间
Daily question - input a date and output the day of the year
暑假第一周
Classification of plastic surgery: short in long long long
实例005:三数排序 输入三个整数x,y,z,请把这三个数由小到大输出。
Digital analog 1: linear programming
实例001:数字组合 有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
How can fresh students write resumes to attract HR and interviewers
Go dependency injection -- Google open source library wire
猜谜语啦(8)
Run菜单解析