我正在从事这个开放式cv python项目。我能够加载图像,绘制RGB,并将图像更改为灰度。但是,一旦我尝试旋转图像,终端中就不会弹出任何内容。你知道我做错了什么吗
import cv2
import matplotlib.pyplot as plt
##### loading the image
coffeeImage = cv2.imread("coffee.jpeg")
blue, green, red = cv2.split(coffeeImage)
img_matplotlib = cv2.merge([red, green, blue])
##### plotting RGB image
plt.subplot(122)
plt.title("RGB")
plt.imshow(img_matplotlib)
plt.show()
#### Changing image to grey-scale
grayImage = cv2.cvtColor(coffeeImage,cv2.COLOR_BGR2GRAY)
cv2.imshow('grey-scale',grayImage)
cv2.waitKey(0)
cv2.destroyAllWindows()
#### rotate the image
(h, w) = grayImage.shape[:2]
center = (w / 2, h / 2)
angle90 = 90
scale = 1.0
rotatedImage = cv2.getRotationMatrix2D(center, angle90, scale)
rotated90 = cv2.warpAffine(grayImage, rotatedImage, (h, w))
cv2.imshow('Rotated Image', rotated90)
cv2.waitKey(0)
谢谢
我没有意识到waitkey(0)有特殊的按钮来移动到下一张图片lol
谢谢大家
相关问题 更多 >
编程相关推荐