Halcon 矩阵和图像的运算

 1 ******************************************************************
 2 **********************halcon矩阵和图像的运算***********************
 3 ******************************************************************
 4 dev_clear_window ()
 5 dev_close_window ()
 6 read_image (Image, 'C:/Users/Public/Documents/MVTec/HALCON-18.11-Steady/examples/images/plants/plants_03.png')
 7 *灰度转换
 8 rgb1_to_gray (Image, GrayImage)
 9 get_image_size (Image, Width, Height)
10 *数据类型转换
11 convert_image_type (GrayImage, ImageConverted, 'byte')
12 *生成同样大小的的空图像,灰度值默认为0
13 gen_image_const (Image1, 'byte',  Width, Height)
14 for Index := 1 to 5 by 1
15     
16     add_noise_white (ImageConverted, ImageNoise, 60)
17     
18     ***保存图片,其中 
19     *---------------------'C:/Users/admin/Desktop/halcon/'+Index$'.'---------------------------
20     *其中上面为地址+图像名(Index$'.',,是图像名,'.',保留一位数,'.3',保留三位数)
21     write_image (ImageNoise,  'tiff', 0, 'C:/Users/admin/Desktop/halcon/'+Index$'.')
22     
23     *****----------------------------------------------------------------------------------------------
24     *图像相加,白噪声图像和空图像相加
25     add_image (ImageNoise, Image1, ImageResult, 0.5, 0)           
26 endfor
27 *对得到的5幅图像求均值
28 scale_image (ImageResult, ImageScaled, 0.1, 0)
原文地址:https://www.cnblogs.com/ybqjymy/p/14436229.html