下采样而不进行平滑 [英] Downsampling without smoothing

查看:94
本文介绍了下采样而不进行平滑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OpenCV 2.3.1中是否存在对图像进行降采样的内置方法,而无需事先进行高斯平滑(由pyrDown C ++函数执行).

Is there a built-in way to downsample an image in OpenCV 2.3.1 without prior Gaussian smoothing (which is performed by pyrDown C++ function).

谢谢.

推荐答案

也许您正在寻找 resize().

# Python code:
import cv2
large_img = cv2.imread('our_large_image.jpg')
small_to_large_image_size_ratio = 0.2
small_img = cv2.resize(large_img, # original image
                       (0,0), # set fx and fy, not the final size
                       fx=small_to_large_image_size_ratio, 
                       fy=small_to_large_image_size_ratio, 
                       interpolation=cv2.INTER_NEAREST)

您可以使用任何这些插值方法.

这篇关于下采样而不进行平滑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆