OpenCV之图像插值
Posted MachineLP
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV之图像插值相关的知识,希望对你有一定的参考价值。
python代码:
import cv2 as cv
src = cv.imread("./test.png")
cv.namedWindow("input", cv.WINDOW_AUTOSIZE)
cv.imshow("input", src)
h, w = src.shape[:2]
print(h, w)
dst = cv.resize(src, (w*2, h*2), fx=0.75, fy=0.75, interpolation=cv.INTER_NEAREST)
cv.imshow("INTER_NEAREST", dst)
dst = cv.resize(src, (w*2, h*2), interpolation=cv.INTER_LINEAR)
cv.imshow("INTER_LINEAR", dst)
dst = cv.resize(src, (w*2, h*2), interpolation=cv.INTER_CUBIC)
cv.imshow("INTER_CUBIC", dst)
dst = cv.resize(src, (w*2, h*2), interpolation=cv.INTER_LANCZOS4)
cv.imshow("INTER_LANCZOS4", dst)
# cv.warpAffine()
cv.waitKey(0)
cv.destroyAllWindows()
C++代码:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespa
以上是关于OpenCV之图像插值的主要内容,如果未能解决你的问题,请参考以下文章
OpenCV ——双线性插值(Bilinear interpolation)