Halcon一日一练:获取程序运行时间
2024-08-24 13:29:29
很多时候,我们需要知道每个函数的运算周期,以提高程序的运行效率。知道运行时间对于图像算法处理很重要
Halcon提供相关的算子,我们先来看代码:
**获取图像处理时间
read_image(Image,'fuse')//读取图像
count_seconds(Seconds)//读取时间
threshold(Image, Region, , )//阈值分割
count_seconds(Seconds1)//读取时间
PTime:=(*(Seconds-Seconds1))//计算阈值分割时间
count_seconds(Seconds2)//读取时间
auto_threshold(Image, Regions, )//自动阈值分割
count_seconds(Seconds3)//读取时间
PTime2:=(*(Seconds3-Seconds2))//计算自动阈值分割时间
count_seconds()是当前的系统时间,这个时间的值以秒为单位,PTime计算的时间是以毫秒单位。实际上这两个算子都是在毫秒内完成的。
下面看一下控制延时的算子:wai_seconds()的用法。我们设置延时1秒。
**延时一秒
Image_Name:=['adhesive_bead_01','adhesive_bead_02','adhesive_bead_03','adhesive_bead_04','adhesive_bead_05',\
'adhesive_bead_06','adhesive_bead_07','adhesive_bead_ref']//设置图像
read_image(Image,'bead/'+Image_Name)//读取图像
channels_to_image(Image,Image)//把单通道图像转换为一个多通道图像
count_channels(Image, Channels)//计算图像通道 for index:= to Channels by
access_channel(Image,Channel,index)//获取多通道图像的一个通道
dev_display(Channel)
wait_seconds()//等待一秒
endfor phot_stereo(Image,Height,[,,,,,,,],[,,,,,,,])
for Index:= to by
shade_height_field(Height, ImageShade, , Index, , , 'false')
dev_display(ImageShade) endfor
最新文章
- Torch7学习笔记(二)nn Package
- 淘宝技术发展(Java时代:脱胎换骨)
- cocos2d-x动作原理
- <;a>;多颜色标签点击之后保持原色的一次实践, Ext Panel下解决及通用方案思路
- 解决UITableViewCell左侧分割线有空白的问题
- L12 samba服务器搭建
- Objective-c 截取子字符串
- Request.getparameternames 获取form表单里面所有的请求参数 。 返回一个Enumeration类型的枚举.
- burp基本使用
- vscode ";find all references"; 提示: no result found.
- vue2.0的初始化
- Android Service解析
- windows 下 react-native(v0.56) Android 环境搭建踩坑记录
- HTML&CSS精选笔记_列表与超链接
- Spring Boot 开发入门
- centos7系统nginx下phalcon环境搭建
- NetCore下模拟和使用Modbus工业通信协议
- linux权限及目录
- JSP导入包
- 【指数型母函数】hdu1521 排列组合