Skip to content

opencv not terminating in shell or in jupyter notebook after inshow display image  #532

Open
@danishkhangithub

Description

@danishkhangithub

this is the code

# import libraries
import cv2

def face_detection():
    # load some pre-trained data on face frontals from opencv (haar cascade algorithm)
    trained_face_data = cv2.CascadeClassifier('./haarcascade_files/haarcascade_frontalface_default.xml')

    # show an image to detect
    cv2.namedWindow('output', cv2.WINDOW_AUTOSIZE)
    img = cv2.imread('./images/rdj.jpg')
    #ims = cv2.resize(img, (110, 540))
    cv2.imshow('Face detector', img)

    cv2.waitKey(0)

    cv2.destroyAllWindows()


    print('completed')

if __name__ == '__main__':
   face_detection()`

and the output is :

(scrpers) (base) danish-khan@danishkhan-Latitude-E6430:~/scrapers/machine_learning1/face_detection1$ python face_detection2.py

and this terminal is not ending even i forcefully want to ends it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions