为什么 cv2.transpose() 不写入目的地?
Why doesn't cv2.transpose() write to destination?
我正在尝试使用 opencv 转置图像,python 但是当我为它设置目标时,它不会写入它,所以当我查看输出图像时我只看到黑屏。为什么会这样?
这是我的代码;
import cv2
import numpy as np
a=np.zeros(image.shape).astype(image.dtype)
cv2.transpose(image,a)
cv2.imwrite("a.png",a)
cv2.imshow("hh",a)
cv2.waitKey(0)
cv2.destroyAllWindows()
文档https://docs.opencv.org/master/d2/de8/group__core__array.html#ga46630ed6c0ea6254a35f447289bd7404
OpenCV 对它无法完全修改(调整大小)的矩阵很敏感。它可以为 cv::Mat 做到这一点。它不能用于 numpy 数组。
只需使用a = cv2.transpose(image)
我正在尝试使用 opencv 转置图像,python 但是当我为它设置目标时,它不会写入它,所以当我查看输出图像时我只看到黑屏。为什么会这样?
这是我的代码;
import cv2
import numpy as np
a=np.zeros(image.shape).astype(image.dtype)
cv2.transpose(image,a)
cv2.imwrite("a.png",a)
cv2.imshow("hh",a)
cv2.waitKey(0)
cv2.destroyAllWindows()
文档https://docs.opencv.org/master/d2/de8/group__core__array.html#ga46630ed6c0ea6254a35f447289bd7404
OpenCV 对它无法完全修改(调整大小)的矩阵很敏感。它可以为 cv::Mat 做到这一点。它不能用于 numpy 数组。
只需使用a = cv2.transpose(image)