简体   繁体   中英

module 'cv2.cv2' has no attribute 'cvtcolor'

I never used python and openCV before and I don't know what is the problem.

from PIL import ImageGrab
import cv2
import time

last_time = time.time()
while(True):
        screen = np.array(ImageGrab.grab(bbox=(0,40, 640, 480)))
        print('Loop took {} second'.format(time.time()-last_time))
        cv2.imshow('window', cv2.cvtcolor(screen, cv2.COLOR_BRG2RGB))
        if cv2.waitKey(25) & 0xFF == ord('q'):
                cv2.destroyAllWindow()
                break

this is the code, can somebody help me understand the problem?

thanks

the code with the error, sorry for the language translate from italian

Error duting the runtime

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM