是否可以旋转图像并保留真实值?旋转黑白图像时,我会得到灰度值。我可以在不平均像素值的情况下旋转吗?我几乎可以使用np.where()
手动完成此操作,但是当像素值超过2个时,它会变得很困难。
代码:
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from scipy import ndimage
import cv2
filename = 'rot square.png'
img = cv2.imread('square test.png')
img_rot = ndimage.rotate(img, 10, reshape = False)
cv2.imwrite(filename, img_rot)
原始图像
旋转图像
平均值]
真实值
是否可以旋转图像并保留真实值?旋转黑白图像时,我会得到灰度值。我可以在不平均像素值的情况下旋转吗?我几乎可以手动完成...
这里: