[英]What does None in cv2.resize mean?
I came across the following snippet used to resize an image:我遇到了以下用于调整图像大小的代码段:
img = cv2.resize(img, None, fx = 1/3, fy = 1/3)
What is the call actually doing?电话实际上在做什么? Why is the output size parameter set to
None
?为什么输出大小参数设置为
None
? When I tried to run this snippet with OpenCV 3.4.3
, it gives an error but works fine with OpenCV 3.4.2
.当我尝试使用
OpenCV 3.4.3
运行此代码段时,它给出了一个错误,但在OpenCV 3.4.2
运行良好。
I want to emulate this behavior in OpenCV 3.4.3
.我想在
OpenCV 3.4.3
模拟这种行为。 What is it doing and how I could do it?它在做什么,我该怎么做?
OpenCV function resize
has 2 different modes for resizing the image. OpenCV 函数
resize
有 2 种不同的调整图像大小的模式。
fx
and fy
parameters which are used for calculating the output size.fx
和fy
参数指定每个维度的缩放因子。 If both methods are used simultaneously, then fx
and fy
parameters are ignored.如果同时使用这两种方法,则忽略
fx
和fy
参数。 The output size parameter is mandatory for both cases.对于这两种情况,输出大小参数都是必需的。 It means that if we want to use the scaling method, we have to pass
None
in place of the output size parameter.这意味着如果我们想使用缩放方法,我们必须传递
None
来代替输出大小参数。 None
indicates that we do not want to use this parameter. None
表示我们不想使用这个参数。
img = cv2.resize( img, (640, 480) )
img = cv2.resize(img, None, fx = 1.0/3.0, fy = 1.0/3.0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.