cv python 变换大小_如何在python中调整输出图像的大小?

# import the necessary packages

from imutils import paths

import argparse

import cv2

def variance_of_laplacian(image):

# compute the Laplacian of the image and then return the focus

# measure, which is simply the variance of the Laplacian

return cv2.Laplacian(image, cv2.CV_64F).var()

# loop over the input images

for imagePath in paths.list_images("images/"):

# load the image, convert it to grayscale, and compute the

# focus measure of the image using the Variance of Laplacian

# method

image = cv2.imread(imagePath)

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

fm = variance_of_laplacian(gray)

text = "Not Blurry"

# if the focus measure is less than the supplied threshold,

# then the image should be considered "blurry"

if fm < 100:

text = "Blurry"

# show the image

cv2.putText(image, "{}: {:.2f}".format(text, fm), (10, 30),

cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 0, 255), 3)

cv2.imshow("Image", image)

print("{}: {:.2f}".format(text, fm))

key = cv2.waitKey(0)

用这个2173 x 3161输入文件

input image

这是输出节目

the output image

图像被放大,没有显示完整。在

我认为图像的像素会影响输出。那么,我怎样才能像源代码中的输出一样得到所有图像的输出呢?

我需要调整输入图像的大小吗?如何?但如果我这么做,恐怕会影响他的模糊效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值