当前位置:网站首页>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
边栏推荐
- 题解:《压缩技术》(原版、续集版)
- D如何检查null
- 三谈exception——错误处理
- Principle analysis of security rememberme
- Daily question: 1175 Prime permutation
- Solve "sub number integer", "jump happily", "turn on the light"
- Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises
- [unity] using GB2312, the solution to abnormal program after packaging
- What are eNB, EPC and PGW?
- Clean up system cache and free memory under Linux
猜你喜欢
I did it with two lines of code. As a result, my sister had a more ingenious way
Research shows that "congenial" is more likely to become friends
[OpenGL] notes 29. Advanced lighting (specular highlights)
解答:EasyDSS视频点播时音频是否可以设置为默认开启?
Can automatically update the universal weekly report template, you can use it with your hand!
题解:《你的飞碟在这儿》、《哥德巴赫猜想》
日本赌国运:Web3.0 ,反正也不是第一次失败了!
Embedded software development
Redis数据库持久化
【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
随机推荐
上海交大教授:何援军——包围盒(包容体/包围盒子)
What are the classifications of SSL certificates? How to choose the appropriate SSL certificate?
mac(macos Monterey12.2 m1) 个人使用php开发
[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术
记忆函数的性能优化
题解《子数整数》、《欢乐地跳》、《开灯》
Jerry's watch stops ringing [article]
Error function ERF
三谈exception——错误处理
【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
MySQL: Invalid GIS data provided to function st_ geometryfromtext
A better database client management tool than Navicat
net share
研究表明“气味相投”更易成为朋友
Unity skframework framework (XV), singleton singleton
Record idea shortcut keys
PR usage skills, how to use PR to watermark?
Everyone wants to eat a broken buffet. It's almost cold
运维必备——ELK日志分析系统
Three methods of finding LCA of the nearest common ancestor