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

后端 未结 5 1462
渐次进展
渐次进展 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:17

    It is because, python compiler cannot find the image in the place. if you copy the image in the python working directory and do this. it worked for me.

        # keep image in the current working directory
        img=cv2.imread('roi.jpg',1) 
        cv2.imshow('image',img)
    

提交回复
热议问题