Error: (- 215: assertion failed)

Error: (- 215: assertion failed)

Source code:

import cv2

img = cv2.imread('D:\Work\study\jaffe\train\happy\KA.HA1.29.tiff')
cv2.namedWindow("Image")
cv2.imshow('Image', img)
cv2.waitKey (0)

Error:
traceback (most recent call last):
file “d”:/work/study/study_ cv.py ”, line 6, in
cv2.imshow(‘Image’, img)
cv2.error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_ 1534379934306\work\modules\highgui\src\ window.cpp:356 : error: (-215:Assertion failed) size.width&gt ;0 && size.height&gt ;0 in function ‘cv::imshow’

Reason:
it can be seen from pychar that

here is understood as escape character

Correction:

import cv2

img = cv2.imread('D:\Work\study\jaffe\\train\happy\KA.HA1.29.tiff')
cv2.namedWindow("Image")
cv2.imshow('Image', img)
cv2.waitKey (0)

Read More: