使用 OpenCV 提升图像的采样率
在本程序中,我们将提升图像的采样率。提升采样率是指在保持图像的二维表示时增加空间分辨率。它通常用于放大图像上的小区域。我们将使用 openCV 库中的 pyrup() 函数来完成此任务。
原图

算法
Step 1: Read the image. Step 2: Pass the image as a parameter to the pyrup() function. Step 3: Display the output.
示例代码
import cv2
image = cv2.imread('testimage.jpg')
print("Size of image before pyrUp: ", image.shape)
image = cv2.pyrUp(image)
print("Size of image after pyrUp: ", image.shape)
cv2.imshow('UpSample', image)输出
Size of image before pyrUp: (350, 700, 3) Size of image after pyrUp: (700, 1400, 3)

说明
如果我们在使用 pyrUp 函数之前和之后观察图像的大小,我们会发现大小增加了,即我们提升了图像的采样率。
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP