halcon例程学习笔记(1)---一维函数的使用

这篇博客介绍了如何在Halcon 10.0中使用一维函数进行图像处理,重点是auto_threshold和smooth_funct_1d_gauss函数。通过读取图像、计算灰度值分布,应用高斯平滑处理,展示了自动阈值分割和数据拟合的过程。
摘要由CSDN通过智能技术生成

本例程来做halcon10.0版本中的一维函数中auto_threshold.hdev例程

一:例程代码如下:

dev_close_window ()                                                      //关闭窗口
read_image (Aegypt1, 'egypt1')                                     //读取图像
get_image_size (Aegypt1, Width, Height)                  //获取图像宽度和高度
dev_open_window (0, 0, Width, Height, 'black', WindowID)   //打开一个图像大小的窗口
set_display_font (WindowID, 14, 'mono', 'true', 'false')        
dev_set_colored (6)
dev_clear_window ()                      //清空窗口
Sigma := 4                                       //设置平滑初始参数
auto_threshold (Aegypt1, Regions, Sigma)      //图像自动阈值分割

*选定区域的灰度值计算方法

*reduce_domain (Aegypt1, Regions, ImageReduced)
*gray_histo (ImageReduced, Aegypt1, AbsoluteHisto, RelativeHisto)

*

*整个图像区域的灰度值计算
gray_histo (Aegypt1, Aegypt1, AbsoluteHisto, RelativeHisto)        //获取图像的灰度分布值
disp_continue_message (WindowID, 'black', 'true')
stop ()
dev_clear_window ()
create_funct_1d_array (AbsoluteHisto, Function)          //创建一维函数数组
smooth_funct_1d_gauss (Function, Sigma, SmoothedFunction)   //使用高斯平滑一维函数
dev_set_color ('red')
funct_1d_to_pairs (SmoothedFunction, XValues, YValues)      //获得对应的一维函数值 并存放到YValues
gen_region_histo (Histo1, YValues, 24, 255, 1)                            //创建区域灰度直方图
dev_display (Aegypt1)
dev_set_color ('white')
gen_region_histo (Histo2, RelativeHisto, 255, 255, 1)        

二:详解关键函数(下面只是自己对函数的个人理解,望指正)

1:gray_histo 计算灰度值分布

gray_histo(Regions,Image : : :AbsoluteHisto,RelativeHisto)

Regions (input_object)  region(-array) object

Region in which the histogram is to be calculated.

Image (input_object)  image object (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)

Image the gray value distribution of which is to be calculated.

AbsoluteHisto (output_control)  histogram-array

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值