I dont understand this error while using template.shape?

asked 2018-12-26 04:38:42 -0500

updated 2019-12-04 10:06:20 -0500

supra56 gravatar image

Code:

img = cv.imread('C:\\Users\\user\\Desktop\\download.jpg',0)
img2 = img.copy()
template = cv.imread('C:\\Users\\user\\Desktop\\download1.jpg',0)
w, h = template.shape[::-1]

error is :

 w, h = template.shape[::-1]
edit retag flag offensive close merge delete

Comments

2

Please try to improve your message. Use icon 101010 to indent your code and insert an error message as text in your post and use this code to read an image :

#Read an image
img = cv.imread("C:/Users/user/Desktop/download.jpg",cv.IMREAD_GRAYSCALE)
#Check if image is empty
if img is None:
    print ( "Image is empty.Check image file path\n")
    exit()
LBerger gravatar imageLBerger ( 2018-12-26 05:19:06 -0500 )edit