我试图检查实际上是通过cv2.imread()读取了哪些数据,但是每当执行此操作时,我都会得到全灰屏。我应该得到一张彩虹图像。
def detect_pixels():
txt_parts = {}
path = r'C:\Users\Singh\Documents\jpgtotxt\rainbow.jpg'
BRG = cv2.imread(path)
cv2.imshow('BRG', BRG)
time.sleep(3)
答案 0 :(得分:0)
在std::chrono
之后添加cv2.waitKey(0)
答案 1 :(得分:0)
将cv2.imshow()
替换为time.sleep(3)
。
答案 2 :(得分:0)
def detect_pixels():
txt_parts = {}
path = r'C:\Users\Singh\Documents\jpgtotxt\rainbow.jpg'
BRG = cv2.imread(path)
cv2.imshow('BRG', BRG)
cv2.waitKey(0)
cv2.destroyAllWindows()