当前位置:网站首页>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
边栏推荐
- 题解:《你的飞碟在这儿》、《哥德巴赫猜想》
- Lucky numbers in the [leetcode daily question] matrix
- Node. JS accessing PostgreSQL database through ODBC
- de4000h存储安装配置
- 能自动更新的万能周报模板,有手就会用!
- 每日一题:1175.质数排列
- 基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
- Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking
- 上海交大教授:何援军——包围盒(包容体/包围盒子)
- Solution: Compression Technology (original version and sequel version)
猜你喜欢

(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
![2022 zero code / low code development white paper [produced by partner cloud] with download](/img/46/92c51090e0c476df3bcffd2d11fb6d.png)
2022 zero code / low code development white paper [produced by partner cloud] with download

Find love for speed in F1 delta time Grand Prix

Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises

What are eNB, EPC and PGW?

2022零代码/低代码开发白皮书【伙伴云出品】附下载

Gee learning notes 2
![[OpenGL] notes 29. Advanced lighting (specular highlights)](/img/6e/56bc7237f691a4355f0b7627b3003e.png)
[OpenGL] notes 29. Advanced lighting (specular highlights)

Japan bet on national luck: Web3.0, anyway, is not the first time to fail!

Unity SKFramework框架(十六)、Package Manager 开发工具包管理器
随机推荐
[Unity]使用GB2312,打包后程序不正常解决方案
Unity skframework framework (XX), VFX lab special effects library
Unity skframework framework (XXI), texture filter map resource filtering tool
Performance optimization of memory function
JS reverse row query data decryption
不会看器件手册的工程师不是个好厨子
Unity skframework framework (XVIII), roamcameracontroller roaming perspective camera control script
(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP
Let juicefs help you with "remote backup"
De4000h storage installation configuration
Crowncad (crown CAD), the first fully independent 3D CAD platform based on Cloud Architecture in China
Finally, someone explained the supervised learning clearly
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
Why is the default of switch followed by break?
互联网常见34个术语解释
记忆函数的性能优化
Unity skframework framework (XIII), question module
Record idea shortcut keys
[unity] using GB2312, the solution to abnormal program after packaging
leetcode621. 任务调度器