halcon例程学习笔记(1)---一维函数的使用
来源:互联网 发布:c语言枚举类型定义 编辑:程序博客网 时间:2024/06/07 20:33
本例程来做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 → (integer)
Absolute frequencies of the gray values.
RelativeHisto (output_control) histogram-array → (real)
Frequencies, normalized to the area of the region.
计算一幅图像中某个选定区域Regions的灰度值分布情况,返回0-255的灰度统计值和相对灰度统计值
2:create_funct_1d_array 创建来自Y数组的一维函数
create_funct_1d_array( : :YValues :Function)
YValues (input_control) number(-array) → (real / integer)
X value for function points.
Function (output_control) function_1d-array → (real / integer)
Created function.
将一个Y(一个离散数据点)创建为一个函数
3:smooth_funct_1d_gauss 将一维函数进行高斯平滑处理
smooth_funct_1d_gauss( : :Function,Sigma :SmoothedFunction)
Function (input_control) function_1d-array → (real / integer)
Function to be smoothed.
Sigma (input_control) number → (real)
Sigma of the Gaussian function for the smoothing.
Default value:2.0
Suggested values:0.5, 1.0, 2.0, 3.0, 4.0, 5.0
Typical range of values:0.1 ≤ Sigma ≤ 50.0 (lin)
Minimum increment:0.01
Recommended increment:0.2
SmoothedFunction (output_control) function_1d-array → (real / integer)
Smoothed function.
将一个一维函数Function进行高斯平滑拟合为一个函数,并返回被高斯函数平滑后的曲线函数SmoothedFunction
4:funct_1d_to_pairs 计算一维函数的X对应的Y值
funct_1d_to_pairs( : :Function :XValues,YValues)
Function (input_control) function_1d-array → (real / integer)
Input function.
XValues (output_control) number-array → (real / integer)
X values of the function.
YValues (output_control) number-array → (real / integer)
Y values of the function.
计算一个X对应的Y值并存入YValues数组中
5:gen_region_histo 将一个灰度分布转换到一个区域中显示
gen_region_histo( :Region :Histogram,Row,Column,Scale : )
Region (output_object) region → object
Region containing the histogram.
Histogram (input_control) histogram-array → (integer)
Input histogram.
Row (input_control) point.y → (integer)
Row coordinate of the center of the histogram.
Default value:255
Suggested values:100, 200, 255, 300, 400
Typical range of values:0 ≤ Row ≤ 511
Column (input_control) point.x → (integer)
Column coordinate of the center of the histogram.
Default value:255
Suggested values:100, 200, 255, 300, 400
Typical range of values:0 ≤ Column ≤ 511
Scale (input_control) integer → (integer)
Scale factor for the histogram.
Default value:1
List of values:1, 2, 3, 4, 5, 6, 7
Typical range of values:1 ≤ Scale ≤ 10 (lin)
Minimum increment:1
Recommended increment:1
返回一个区域灰度值图像,在一个区域中。Scale是放大系数,Row,Column是显示的位置
- halcon例程学习笔记(1)---一维函数的使用
- halcon例程学习笔记(3)----一维函数相关算子总结
- halcon例程学习笔记(4)---count_fish_sticks.hdev基本函数使用
- HALCON学习一(Halcon函数)
- Halcon 学习笔记 (一)
- Halcon 学习笔记 (一)
- Halcon 学习笔记 (一)
- halcon例程学习笔记(11) 一维码、二维码识别
- halcon例程学习笔记(11) 一维码、二维码识别
- halcon例程学习笔记(9)---制药的检测check_blister.hdev
- halcon例程学习笔记(2)----check_smd_tilt.hdev
- halcon例程 -- 逐字细究(一)
- Halcon算子学习笔记(一)--Arithmetic
- Halcon学习笔记(一) 基础知识
- Halcon学习笔记(一) 读取图片
- caffe学习笔记(一):MNIST例程
- HALCON学习笔记1
- halcon学习菜鸟级笔记---老老实实学例程1Codabar.hdev
- linux内核文件读取
- 二维数组查找
- NULL与空字符串
- ORACLE和SQL语法区别归纳
- .Net Framework 4 如何静默安装
- halcon例程学习笔记(1)---一维函数的使用
- 发一张我做的动画!
- 【翻译练习】为什么Google不会山寨成功的创业点子?
- 父元素与子iframe相互获取变量和元素对象
- Magento 商城插件二次开发. 遇到 From_Key 验证MD5出错。
- 用户无法远程登录数据库的解决方法
- DevTest 在实际测试运用中的好处
- 再来一个动画!
- hibernate的级联操作cascade