window is closed after pressing q but the program is not terminating.
here is the code : https://ide.codingblocks.com/s/194695
Program is not terminating
Hey @Ajitverma1503, just change the following line and than your code will run fine,
key_pressed = cv2.waitKey(1) & 0xFF (line 21)
Hope this cleared your doubt.
Plz close the doubt if you find that its resolved
I have also try this but it show the same problem.
You may need to press q 2-3 times conitnuously to exit. I copied your code on my system and ran the same, it closes the window and code is also terminated. The error may be due to some local system error. Try running the complete code in jupyter notebook. Make sure to put all these in one single cell.
Hope this resolved your doubt.
This problem is occurring ever time in command prompt I think destroy all window function is not working properly.suggest me something the I do to terminate the program
Try reversing the order
cv2.destroyAllWindows()
cap.release()
print(“Done here”)
And see if “Done here” is printed on the terminal or, not. If destroyAllWindows() didn’t work than you will not see the printed message. Also try running this code,
print function after destroyallwindow is executing. The code you provided is working fine but for the code face_detect program is not terminating.
If print statement is seen, than there is no problem with the code, Try adding exit() at end of code. Also you can hard exit the terminal, ctrl+z for ubuntu and ctrl+ c for the windows. If that also don’t work than there is no choice but to close the terminal directly.
ctrl+c and exit() both are also not working i have tried it lots of time.Can you please tell why this problem is occuring when i use haarcasade file ?
There is no such error with the haarcascade file. This problem is due to some problem on your local system.
The only way out is to close the terminal directly. No other way is possible.
okay then, i will check…
Thank you for the help
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
Education is the most important and powerful tool in this world. It’s not about studying and only getting good marks. ITIL-4-DITS Exam Certification Questions provides authentic IT Certification exams preparation material guaranteed to make you pass in the first attempt.