当前位置:网站首页>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
- [daily training -- Tencent selected 50] 557 Reverse word III in string
- Basic number theory -- Euler function
- C# LINQ源码分析之Count
- Guess riddles (11)
- [daily training] 1200 Minimum absolute difference
- STM32 --- NVIC interrupt
- MATLAB小技巧(28)模糊綜合評價
- Meizu Bluetooth remote control temperature and humidity access homeassistant
- Several problems to be considered and solved in the design of multi tenant architecture
猜你喜欢

UE pixel stream, come to a "diet pill"!

leetcode - 445. Add two numbers II

Arduino operation stm32

Bluebridge cup internet of things basic graphic tutorial - GPIO output control LD5 on and off

猜谜语啦(4)

Agile project management of project management

99 multiplication table (C language)

Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)

STM32 lights up the 1.8-inch screen under Arduino IDE

EA introduction notes
随机推荐
Go dependency injection -- Google open source library wire
STM32---ADC
实例005:三数排序 输入三个整数x,y,z,请把这三个数由小到大输出。
[daily training -- Tencent selected 50] 557 Reverse word III in string
Apaas platform of TOP10 abroad
Shift operation of complement
猜谜语啦(142)
剑指 Offer 09. 用两个栈实现队列
[牛客网刷题 Day4] JZ35 复杂链表的复制
Business modeling | process of software model
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
[three tier architecture]
第十八章 使用工作队列管理器(一)
[three tier architecture and JDBC summary]
Infix expression evaluation
[NAS1](2021CVPR)AttentiveNAS: Improving Neural Architecture Search via Attentive Sampling (未完)
[牛客网刷题 Day4] JZ32 从上往下打印二叉树
[daily training] 1200 Minimum absolute difference
Basic number theory -- Euler function
287. Looking for repeats - fast and slow pointer