******************************************************************
**********************halcon矩阵和图像的运算***********************
******************************************************************
dev_clear_window ()
dev_close_window ()
read_image (Image, 'C:/Users/Public/Documents/MVTec/HALCON-18.11-Steady/examples/images/plants/plants_03.png')
*灰度转换
rgb1_to_gray (Image, GrayImage)
get_image_size (Image, Width, Height)
*数据类型转换
convert_image_type (GrayImage, ImageConverted, 'byte')
*生成同样大小的的空图像,灰度值默认为0
gen_image_const (Image1, 'byte', Width, Height)
for Index := 1 to 5 by 1
add_noise_white (ImageConverted, ImageNoise, 60)
***保存图片,其中
*---------------------'C:/Users/admin/Desktop/halcon/'+Index$'.'---------------------------
*其中上面为地址+图像名(Index$'.',,是图像名,'.',保留一位数,'.3',保留三位数)
write_image (ImageNoise, 'tiff', 0, 'C:/Users/admin/Desktop/halcon/'+Index$'.')
*****----------------------------------------------------------------------------------------------
*图像相加,白噪声图像和空图像相加
add_image (ImageNoise, Image1, ImageResult, 0.5, 0)
endfor
*对得到的5幅图像求均值
scale_image (ImageResult, ImageScaled, 0.1, 0)