Halcon计算图像金字塔,降采样,缩放图像

一、Halcon有专门的算子计算图像金字塔,也有专门的缩放算子。非常适合做项目压缩图像使用,不管是上采样还是降采样都可以
二、代码

read_image (Image, 'C:/Users/Dell/Desktop/11.bmp')
*计算图像高斯金字塔,每层为原来1/2,得到N层金字塔,第N层是1×1
gen_gauss_pyramid (Image, ImagePyramid, 'constant', 0.5)
*查看金字塔一共有多少层
count_obj (ImagePyramid, Number)
*获取第4层,即原图的1/8
select_obj (ImagePyramid, ObjectSelected, 3)

*降采样算子,可以实现金字塔降采样功能,同时可以升采样。
zoom_image_factor (Image, ImageZoomed, 0.1, 0.1, 'constant')
*图像缩放到指定尺寸
zoom_image_size (ImageZoomed, ImageZoom, 2512, 2512, 'constant')
*冲击波滤波,可以明显增强边缘对比度,减少过度像素
shock_filter (ObjectSelected, SharpenedImage,0.5, 10, 'canny', 1.5)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Douhaoyu/article/details/128422144