工控编程吧
标题:
halcon 函数工具分类介绍
[打印本页]
作者:
qq263946146
时间:
2019-5-25 22:46
标题:
halcon 函数工具分类介绍
上halcon中算子有tools分类,其下边有functions子分类,
这里通过单步运行每个函数,可以查看函数的功能和实现的效果
下面是这共25个函数的例程,例程对函数功能都有作注释
dev_close_window ()
dev_open_window (0, 0, 512, 512, 'white', WindowHandle)
dev_set_color ('black')
dev_set_line_width (2)
X := []
for J := -125 to 125 by 1
X := [X,J / 40.0]
endfor
create_funct_1d_pairs (X, cos(X), Cos)
X := []
for J := -100 to 100 by 1
X := [X,J / 10.0]
endfor
stop()
*integrate_funct_1d功能:计算一个函数的正区域和负区域。
integrate_funct_1d (Cos, Positive, Negative)
*create_funct_1d_pairs功能:从(X,Y)集合中创建一个函数。
create_funct_1d_pairs (X, atan(X), ATan)
*compose_funct_1d功能:组合两个函数。
compose_funct_1d (ATan, Cos, 'constant', CosATan)
plot_funct_1d (WindowHandle, ATan, 'x', 'atan(x)', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop ()
dev_clear_window ()
*derivate_funct_1d功能:计算一个函数的派生物。
derivate_funct_1d (CosATan, 'first', Derivative)
plot_funct_1d (WindowHandle, Derivative, 'x', 'atan(x)', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop ()
dev_clear_window ()
*invert_funct_1d功能:计算一个函数的反转。
invert_funct_1d (ATan, InverseFunction)
plot_funct_1d (WindowHandle, InverseFunction, '', '', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop()
dev_clear_window ()
*negate_funct_1d功能:对Y值取非(反)。
negate_funct_1d (InverseFunction, FunctionInverted)
plot_funct_1d (WindowHandle, FunctionInverted, '', '', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
*zero_crossings_funct_1d功能:计算一个函数的零点
zero_crossings_funct_1d (FunctionInverted, ZeroCrossings)
stop()
dev_clear_window ()
*abs_funct_1d功能:Y值的绝对值。
abs_funct_1d (InverseFunction, FunctionAbsolute)
plot_funct_1d (WindowHandle, FunctionAbsolute, '', '', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop()
dev_clear_window ()
create_funct_1d_pairs (X, 1 / sqrt(1 + X * X), InvSqrt1pSqX)
plot_funct_1d (WindowHandle, InvSqrt1pSqX, 'x', '1/sqrt(1+x*x)', 'red', ['axes_color','origin_x','origin_y','start_y'], ['black',0,0,0])
stop()
dev_clear_window ()
read_image (Aegypt1, 'egypt1')
get_image_size (Aegypt1, Width, Height)
auto_threshold (Aegypt1, Regions, 4)
gray_histo (Aegypt1, Aegypt1, AbsoluteHisto, RelativeHisto)
*create_funct_1d_array功能:从Y值的序列中创建一个函数。
create_funct_1d_array (AbsoluteHisto, Function)
*smooth_funct_1d_gauss功能:采用高斯函数平滑一个等距一维函数。
smooth_funct_1d_gauss (Function, 4, SmoothedFunction)
*smooth_funct_1d_mean功能:采用平均值将一个等距一维函数平滑化。
smooth_funct_1d_mean (SmoothedFunction, 9, 3, SmoothedFunction1)
*funct_1d_to_pairs功能:查询一个函数的(X,Y)值。
funct_1d_to_pairs (SmoothedFunction1, XValues, YValues)
gen_region_histo (Histo1, YValues, 255, 255, 1)
dev_display (Histo1)
*write_funct_1d功能:将一个函数写入一个文件。
write_funct_1d (SmoothedFunction, '123.fun')
*read_funct_1d功能:从文件中读取一个函数。
read_funct_1d ('123.fun', Func)
funct_1d_to_pairs (Func, XValues, YValues)
gen_region_histo (Histo2, YValues, 255, 255, 1)
*local_min_max_funct_1d功能:计算一个函数的局域最小和最大值点。
local_min_max_funct_1d (Func, 'strict_min_max', 'true', Min, Max)
*x_range_funct_1d功能:函数的最小和最大X值。
x_range_funct_1d (Func, XMin, XMax)
*y_range_funct_1d功能:函数的最小和最大Y值。
y_range_funct_1d (Func, YMin, YMax)
stop()
dev_clear_window ()
*scale_y_funct_1d功能:将Y值相乘和相加。
scale_y_funct_1d (Func, 0.5, 1, FunctionScaled)
plot_funct_1d (WindowHandle, FunctionScaled, '', '', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop()
*match_funct_1d_trans功能:计算两个函数传递参数。
match_funct_1d_trans (Func, FunctionScaled, 'constant', [1.0,0.0,1.0,0.0], ['true','true','true','true'], Params, ChiSquare, Covar)
*get_y_value_funct_1d功能:返回任意位置函数的值。
get_y_value_funct_1d (FunctionScaled, 200, 'constant', Y)
*num_points_funct_1d功能:函数控制点的数目。
num_points_funct_1d (FunctionScaled, Length)
*get_pair_funct_1d功能:根据控制点的索引查询一个函数值。
get_pair_funct_1d (FunctionScaled, 5, X1, Y1)
*sample_funct_1d功能:再间隔区等距取样。
sample_funct_1d (FunctionScaled, 10, 20, 30, 'constant', SampledFunction)
NPT := 100
MPT := 100
GM := [30.0,65.0]
GS := [15.0,25.0]
GA := [20.0,15.0]
E := [0.8,20.0,1.4,-10.0]
X1 := []
Y1 := []
for I := 0 to NPT - 1 by 1
X := E[2] * I + E[3]
Y := GA[0] * exp(-pow((X - GM[0]) / GS[0],2)) + GA[1] * exp(-pow((X - GM[1]) / GS[1],2))
F := E[0] * Y + E[1]
X1 := [X1,I]
Y1 := [Y1,F]
endfor
X2 := []
Y2 := []
for I := 0 to MPT - 1 by 1
X := I
Y := GA[0] * exp(-pow((X - GM[0]) / GS[0],2)) + GA[1] * exp(-pow((X - GM[1]) / GS[1],2))
X2 := [X2,I]
Y2 := [Y2,Y]
endfor
C1 := E
C2 := [1 / E[0],-E[1] / E[0],1 / E[2],-E[3] / E[2]]
* Create a function from a sequence of y-values
create_funct_1d_array (Y1, F1)
create_funct_1d_array (Y2, F2)
match_funct_1d_trans (F1, F2, 'constant', [1.0,0.0,1.0,0.0], ['true','true','true','true'], ParamsF1, ChiSquareF1, CovarF1)
match_funct_1d_trans (F2, F1, 'constant', [1.0,0.0,1.0,0.0], ['true','true','true','true'], ParamsB1, ChiSquareB1, CovarB1)
*transform_funct_1d 功能:根据给定传递参数变换一个函数。
transform_funct_1d (F2, ParamsF1, F2Trans)
*distance_funct_1d功能:计算两个函数的间隔。
distance_funct_1d (F1, F2, 'length', 0, Distance)
dev_clear_window ()
plot_funct_1d (WindowHandle, F2Trans, '', '', 'red', ['axes_color','origin_x','origin_y'], ['black',0,0])
stop()
[halcon]1[/halcon]
欢迎光临 工控编程吧 (https://www.gkbc8.com/)
Powered by Discuz! X3.4