Make your life easier with imshow()

Everybody knows how annoying the cv2.imshow() function is, especially when debugging. We need to keep creation names for the first parameter of the function, which tends to interrupt the flow and hang your program if you have a slow computer. Add or import this function to make life easier.

import cv2
import numpy as np
window = 1
def imshow(img):
    global window
    name = "Window %d" %(window)
    window +=1
    cv2.imshow(name, img)

Leave a comment