当我遇到这个时,我正在浏览 cv2.resize 的 opencv 文档:
cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst
方括号是什么意思?我在文档的很多地方都遇到过它们。方括号的层次结构重要吗?(最里面和最外面)一个例子真的很有帮助。这是文档的链接:https : //docs.opencv.org/3.0-beta/modules/imgproc/doc/filtering.html
它的文档风格:
以下是几个示例:
image = cv2.imread("my_image.jpg") # src
# resize the image to 200x200px, ignoring aspect ratio
resized = cv2.resize(image, (200, 200))
cv2.imshow("Fixed Resizing", resized)
和
# fixed resizing and distort aspect ratio
# to be 300px but compute the new height based on the aspect ratio
image = cv2.imread("my_image.jpg") # src
(h, w, d) = image.shape
print("width={}, height={}, depth={}".format(w, h, d))
r = 300.0 / w
dim = (300, int(h * r))
resized = cv2.resize(image, dim)
cv2.imshow("Aspect Ratio Resize", resized)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句