图像滤波编程
3x3模板均值滤波
原始图像:
3x3模板均值滤波
运行代码:
*均值滤波 read_image(Image,'F:/2020spring/机器视觉/作业/lesson8-实验作业/实验图像.bmp')*读取图像
rgb1_to_gray(Image, GrayImage)
filter3_3:=[3,3,9,1,1,1,1,1,1,1,1,1]*3x3的卷积核
convol_image(GrayImage, ImageResult3_3, filter3_3,'mirrored')*遍历求和平均dev_display(ImageResult3_3)write_image( ImageResult3_3,'bmp',0,'F:/2020spring/机器视觉/作业/lesson8-实验 作业/ImageResult3_3')*输出图像到指定文件夹
运行结果:
运行时间:1ms
3x3可分离滤波器均值滤波
运行代码:
*均值滤波
read_image(Image,'F:/2020spring/机器视觉/作业/lesson8-实验作业/实验图像.bmp')*读取图像
rgb1_to_gray(Image, GrayImage)
filter3_1:=[3,1,5,1,1,1]*5x1的卷积核
filter1_3:=[1,3,5,1,1,1]*1x5的卷积核
convol_image(GrayImage, ImageResult3_1, filter3_1,'mirrored')*竖向求和平均
convol_image(GrayImage, ImageResult3_1_3, filter1_3,'mirrored')*横向求和平均dev_display(ImageResult3_1_3)write_image( ImageResult3_1_3,'bmp',0,'F:/2020spring/机器视觉/作 业/lesson8-实验作业/ImageResult13_1_3')*输出图像到指定文件夹
运行结果:
横向遍历求和时间0.6ms
竖向遍历求和平均0.7ms