OpenCV-Python系列·第五集:图像扩大或缩小

版权声明:本文为博主原创文章,未经博主允许不得转载。若有任何问题,请联系QQ:575925154(加好友时,请备注:CSDN) https://blog.csdn.net/Miracle0_0/article/details/82021579
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 24 16:29:37 2018

@author: Miracle
"""
'''
若扩大图像,请使用INTER_LINEAR(速度快)或INTER_CUBIC(效果佳、速度慢)
若缩小图像,请使用INTER_AREA
'''

import cv2

image = cv2.imread('../data/lena.jpg')
img_linear = cv2.resize(image,None,fx=1.5,fy=1.5,
                        interpolation=cv2.INTER_LINEAR)
cv2.imshow('Inter_Linear scale',img_linear)
img_cubic = cv2.resize(image,None,fx=1.5,fy=1.5,
                        interpolation=cv2.INTER_CUBIC)
cv2.imshow('Inter_Cubic scale',img_cubic)
img_area = cv2.resize(image,(300,300),
                        interpolation=cv2.INTER_AREA)
cv2.imshow('Inter_Area scale',img_area)
cv2.waitKey()

猜你喜欢

转载自blog.csdn.net/Miracle0_0/article/details/82021579
今日推荐