当前位置:网站首页>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




边栏推荐
- Shell script
- Search data in geo database
- Esphone retrofits old fans
- Arrangement of some library files
- PIP installation
- MATLAB skills (28) Fuzzy Comprehensive Evaluation
- Business modeling of software model | vision
- Array integration initialization (C language)
- Basic number theory -- Euler function
- One question per day - replace spaces
猜你喜欢

实例004:这天第几天 输入某年某月某日,判断这一天是这一年的第几天?

Explore the authentication mechanism of StarUML

Lori remote control commissioning record

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

Guess riddles (6)

Business modeling of software model | stakeholders

Example 010: time to show

Guess riddles (8)

Count the number of inputs (C language)

MATLAB小技巧(28)模糊综合评价
随机推荐
STM32 lights up the 1.8-inch screen under Arduino IDE
C language data type replacement
Guess riddles (2)
Search data in geo database
猜谜语啦(10)
猜谜语啦(142)
How can fresh students write resumes to attract HR and interviewers
Example 003: a complete square is an integer. It is a complete square after adding 100, and it is a complete square after adding 168. What is the number?
MATLAB skills (28) Fuzzy Comprehensive Evaluation
[NAS1](2021CVPR)AttentiveNAS: Improving Neural Architecture Search via Attentive Sampling (未完)
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
Esp8266 interrupt configuration
GEO数据库中搜索数据
[牛客网刷题 Day4] JZ35 复杂链表的复制
图解八道经典指针笔试题
Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)
实例010:给人看的时间
Digital analog 1: linear programming
Guess riddles (6)
Example 008: 99 multiplication table