why cv2.imshow() results in error in my python compiler?

后端 未结 5 1455
渐次进展
渐次进展 2020-12-11 21:04

Hi friends i just now installed opencv and checking the basic code but it results in error. The code is

import numpy as np
import cv2
img=cv2.imread(\'C:\\U         


        
5条回答
  •  盖世英雄少女心
    2020-12-11 21:27

    Most likely, the imread call didn't succeed. Make sure the image "C:\Users\Pravin\Desktop\a.jpeg" exists. (The extension .jpeg seems unusual, maybe it has to be .jpg?)

    Also, as Hyperboreus suggests, please, try using forward slashes in the filename "C:/Users/Pravin/Desktop/a.jpg", or escape backslashes

    "C:\\Users\\Pravin\\Desktop\\a.jpg"
    

提交回复
热议问题