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




边栏推荐
- 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?
- 猜谜语啦(11)
- Cmder of win artifact
- 暑假第一周
- Example 005: three numbers sorting input three integers x, y, Z, please output these three numbers from small to large.
- Chapter 18 using work queue manager (1)
- Digital analog 2: integer programming
- Is the security account given by Yixue school safe? Where can I open an account
- 【三层架构】
- Guess riddles (7)
猜你喜欢
随机推荐
Guess riddles (2)
Meizu Bluetooth remote control temperature and humidity access homeassistant
STM32 --- GPIO configuration & GPIO related library functions
How to write cover letter?
Example 008: 99 multiplication table
287. Looking for repeats - fast and slow pointer
[NAS1](2021CVPR)AttentiveNAS: Improving Neural Architecture Search via Attentive Sampling (未完)
Esphone retrofits old fans
STM32 single chip microcomputer - external interrupt
C语言标准函数scanf不安全的原因
Agile project management of project management
GEO数据库中搜索数据
The first week of summer vacation
Chapter 18 using work queue manager (1)
第十八章 使用工作队列管理器(一)
Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)
One question per day - replace spaces
PIP installation
STM32---ADC
Run menu analysis




![[noi simulation] juice tree (tree DP)](/img/19/bc71e8dc3958e4cb87b31423a74617.png)


