当前位置:网站首页>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
边栏推荐
猜你喜欢

诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...

运维必备——ELK日志分析系统

伙伴云表格强势升级!Pro版,更非凡!

OpenApi-Generator:简化RESTful API开发流程

Node.js通过ODBC访问PostgreSQL数据库

上海交大教授:何援军——包围盒(包容体/包围盒子)

Fundamentals of face recognition (facenet)
![[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology](/img/a7/44609a5acf25021f1fca566c3d8c90.png)
[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology

嵌入式软件开发

Unity skframework framework (XIV), extension extension function
随机推荐
三谈exception——错误处理
Jerry's watch ringtone audition [article]
Unity SKFramework框架(十二)、Score 计分模块
Fundamentals of machine learning (II) -- division of training set and test set
SAP MM 因物料有负库存导致MMPV开账期失败问题之对策
Node.js通过ODBC访问PostgreSQL数据库
题解:《你的飞碟在这儿》、《哥德巴赫猜想》
leetcode621. task scheduler
屠榜多目标跟踪!BoT-SORT:稳健的关联多行人跟踪
TVOC, VOC, VOCs gas detection + Solution
为什么switch 的default后面要跟break?
D为何链接不了dll
运维必备——ELK日志分析系统
2022 Heilongjiang provincial examination on the writing skills of Application Essays
中文姓名提取(玩具代码——准头太小,权当玩闹)
Web基础
nohup命令
研究表明“气味相投”更易成为朋友
net share
无向图的桥