use cv.imshow Error: (- 215: assertion failed) size.width >0 && size.height >0 in function ‘cv::imshow’

USES cv2 to display images:

import tensorflow as tf
import cv2 as cv
image = cv.imread('F:\CODES\n07740461_173.jpg')
cv.imshow("input", image)


resolution 1: changes the “\” of the image path to “/” to display correctly.

image = cv.imread('F:/CODES/n07740461_173.jpg')

resolution 2: in the image path before the “r”, can be displayed correctly.

image = cv.imread(r'F:\CODES\n07740461_173.jpg')

Read More: