简体   繁体   中英

Expected Ptr<cv::UMat> for argument '%s'

I am not able to proceed after this step

 f='/content/drive/My Drive/resized'
    f_len=len(f)
    os.mkdir('grayscale20')
    for image in os.listdir(f):
    
        img=os.path.join(f,image)
                
        img = cv2.imread(f)
        grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        #grayImg = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        cv2.imwrite("grayscale",+f[folderLen:],grayImg)
    cv2.destroyAllWindows   
    
    
    

Please refer to these pics
1 2

而不是img = cv2.imread(f)你应该使用img = cv2.imread(img)

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