当前位置:网站首页>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
边栏推荐
- [formation quotidienne - Tencent Selection 50] 557. Inverser le mot III dans la chaîne
- Run menu analysis
- [matlab] matlab reads and writes Excel
- 实例004:这天第几天 输入某年某月某日,判断这一天是这一年的第几天?
- Cmder of win artifact
- Esphone Feixun DC1 soft change access homeassstant
- 每日一题——替换空格
- Digital analog 2: integer programming
- Guess riddles (5)
- 99 multiplication table (C language)
猜你喜欢
[three tier architecture]
319. Bulb switch
Run menu analysis
Classification of plastic surgery: short in long long long
Shift operation of complement
Guess riddles (6)
Guess riddles (11)
Example 008: 99 multiplication table
Example 001: the number combination has four numbers: 1, 2, 3, 4. How many three digits can be formed that are different from each other and have no duplicate numbers? How many are each?
Business modeling of software model | stakeholders
随机推荐
Guess riddles (5)
[牛客网刷题 Day4] JZ55 二叉树的深度
Digital analog 2: integer programming
【三层架构及JDBC总结】
Speech recognition learning summary
Count the number of inputs (C language)
每日一题——输入一个日期,输出它是该年的第几天
Guess riddles (11)
Program error record 1:valueerror: invalid literal for int() with base 10: '2.3‘
EA introduction notes
Arduino burning program and Arduino burning bootloader
2020-05-21
Business modeling of software model | overview
Pytorch entry record
An enterprise information integration system
Bluebridge cup internet of things basic graphic tutorial - GPIO output control LD5 on and off
Basic number theory - factors
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
实例009:暂停一秒输出
Guess riddles (9)