当前位置:网站首页>Halcon extract orange (Orange)
Halcon extract orange (Orange)
2022-07-02 13:38:00 【Ride the magic horse and ride the clouds】
demand : Extract oranges from the following pictures
Code :
dev_set_draw ('margin')
dev_set_line_width (3)
read_image (Image, 'C:/Users/ASUS/Desktop/halcon/ Orange picture /citrus_fruits_01.png')
* List all the pictures in the folder
list_files ('C:/Users/ASUS/Desktop/halcon/ Orange picture ', ['files','follow_links','recursive'], ImageFiles)
* Select the appropriate element
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
* Extract the oranges in each picture by cycling
for Index := 0 to |ImageFiles|-1 by 1
read_image (Image1, ImageFiles[Index])
rgb1_to_gray (Image1, GrayImage)
decompose3 (Image1, ImageR, ImageG, ImageB)
threshold (ImageR, Regions, 40, 255)
connection (Regions, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ['circularity','area'], 'and', [0.8,150], [1,99999])
* display picture
dev_display(Image1)
* Show the selected area
dev_display(SelectedRegions)
endfor
Effect display :
explain
1. Why in the red passage ( Left ) Perform threshold segmentation on ? Because the background of the picture is indigo , If directly in the original image to gray image ( Right ) Upper threshold segmentation , The effect of some pictures is not good , As shown in the figure below :
2. Picture material :halcon Orange extract picture material - Internet document resources -CSDN download
边栏推荐
- Unity skframework framework (XV), singleton singleton
- Verification failed, please check your call back website. You can follow the instructions
- SSL证书的分类有哪些?如何选择合适的SSL证书?
- 三翼鸟两周年:羽翼渐丰,腾飞指日可待
- 记忆函数的性能优化
- What are eNB, EPC and PGW?
- 【云原生数据库】遇到慢SQL该怎么办(上)?
- TVOC, VOC, VOCs gas detection + Solution
- MySQL: Invalid GIS data provided to function st_ geometryfromtext
- Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking
猜你喜欢
题解《子数整数》、《欢乐地跳》、《开灯》
EasyDSS点播服务分享时间出错如何修改?
MAC (MacOS Monterey 12.2 M1) personal use PHP development
Redis database persistence
What are eNB, EPC and PGW?
OpenFOAM:lduMatrix&lduAddressing
I did it with two lines of code. As a result, my sister had a more ingenious way
Embedded software development
Fundamentals of face recognition (facenet)
Research shows that "congenial" is more likely to become friends
随机推荐
Unity SKFramework框架(十二)、Score 计分模块
Add sequence number column to query results in MySQL
[true topic of the Blue Bridge Cup trials 43] scratch space flight children's programming explanation of the true topic of the Blue Bridge Cup trials
Three methods of finding LCA of the nearest common ancestor
Gee learning notes 2
Detailed collection of common MySQL commands
科技的成就(二十七)
Skillfully use SSH to get through the Internet restrictions
Record idea shortcut keys
操作教程:EasyDSS如何将MP4点播文件转化成RTSP视频流?
Word efficiency guide - word's own template
Download files and preview pictures
Explanation of 34 common terms on the Internet
Everyone wants to eat a broken buffet. It's almost cold
Jerry's watch ringtone audition [article]
Nohup command
量子三体问题: Landau Fall
Why can't d link DLL
Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm
Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises