图像数学运算-三角函数运算
1 正弦计算与反正弦计算
sin_image计算图像的正弦值,如果图像类型是direction或cylic类型,则sin_image将图像灰度值转换为角度值;如果图像类型是real类型,则sin_image则认为图像灰度值为角度值。sin_image的原型如下:
- sin_image(Image : SinImage : : )
其中,参数Image为输入图像,SinImage为输出图像;
asin_image计算图像的反正弦值。其原型如下:
- asin_image(Image : ArcsinImage : : )
其中,参数Image为输入图像;ArcsinImage为输出图像;
2 余弦计算与反余弦计算
cos_image计算图像的余弦值,其原型如下:
- cos_image(Image : CosImage : : )
其中,参数Image为输入图像;CosImage为输出图像;
acos_image计算图像的反余弦值,其原型如下:
- acos_image(Image : ArccosImage : : )
其中,参数Image为输入图像;ArccosImage为输出图像
* 图像三角函数计算
* 读取图像
read_image(src,'fabrik')
* 缩放图像像素灰度值
get_image_size(src,width,height)
* 生成图像大小的矩形
gen_rectangle1(rectangle,0,0,width,height)
* 获取图像像素灰度值的最大和最小值
min_max_gray(rectangle,src,0,gmin,gmax,range)
* gmax := 179
* gmin := 0
mult := 255 / (gmax - gmin)
add := -mult * gmin
* 图像像素灰度值缩放
scale_image(src,src_scaled,mult,add)
* 转换direction类型
convert_image_type(src_scaled,src_direction,'direction')
sin_image(src_direction,result_direction)
* 使用cyclic类型计算
convert_image_type(src_scaled,src_cyclic,'cyclic')
* 对图像进行正弦计算
sin_image(src_cyclic,result_cyclic)
* 反正弦函数
asin_image(result_direction,result_asin_direction)
* 转换图像类型
convert_image_type(result_asin_direction,result_byte,'byte')
scale_image(result_byte,result_scaled,255,0)
* 反正弦函数
acos_image(result_direction,result_acos_direction)
* 转换图像类型
convert_image_type(result_acos_direction,result_byte,'byte')
scale_image(result_byte,result_scaled,255,0)
3 正切与反正切计算
tan_image计算图像的正切值,其原型如下:
- tan_image(Image : TanImage : : )
其中,Image为输入图像;TanImage为输出图像
atan_image计算图像反正切值,其原型如下:
- atan_image(Image : ArctanImage : : )
其中,Image为输入图像;ArctanImage为输出图像
* 图像像素灰度值缩放
convert_image_type(src_scaled,src_direction,'direction')
tan_image(src_direction,result_direction)
* 使用cyclic类型计算
convert_image_type(src_scaled,src_cyclic,'cyclic')
* 对图像进行正弦计算
tan_image(src_cyclic,result_cyclic)
* 反正弦函数
atan_image(result_direction,result_atan_direction)
* 转换图像类型
convert_image_type(result_atan_direction,result_byte,'byte')
scale_image(result_byte,result_scaled,255,0)