opencv / opencv/opencv-python

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

Open
#532 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug incomplete
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported command from face_detection2.py, using the face_detection entry point and the cv2.imshow/waitKey sequence shown. Check whether the behavior is specific to the installed OpenCV GUI backend; done would require a confirmed cause and a documented or tested fix, but the issue names no repository file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
computer-vision, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.