I tried the script again after installing dlib and related libraries. I can see my face with executing the the 1st section of the code. However, the script could not execute the rest of the lines of the code. So it is quite strange.
1. Only exectue the lines of code
I can see the camera works correctly and show my face. But camera screen is keep shaking.
2. Do not execute the rest of the line of the code.
The rest of the lines of code are not executed. It is quite strange.
img_counter = 0
while(True):
ret, frame = cam.read()
faces = face_cascade.detectMultiScale(frame, 1.3, 5)
for (x,y,w,h) in faces:
if w >130:
detected_face = frame[int(y):int(y+h), int(x):int(x+w)]
cv2.imshow("test", detected_face)
if not ret:
break
k = cv2.waitKey(1)
if k%256 == 27:
# ESC pressed
print("hit Esc to skipe and hit Space bar to save image")
break
elif k%256 == 32:
# SPACE pressed
faceresize = cv2.resize(detected_face, (img_size,img_size))
img_name = "dataset/opencv_frame_{}.jpg".format(img_counter)
cv2.imwrite(img_name, faceresize)
print("{} written!".format(img_name))
img_counter += 1
cam.release()
........
3. Can not exit from the camera
The camera is keeping moving and working. After closing the script with jupyter notebook, I still can not exit from the camera. The camera is showing my face until turning off the computer.
I tried the script again after installing dlib and related libraries. I can see my face with executing the the 1st section of the code. However, the script could not execute the rest of the lines of the code. So it is quite strange.
1. Only exectue the lines of code
I can see the camera works correctly and show my face. But camera screen is keep shaking.
cv2.namedWindow("test")
2. Do not execute the rest of the line of the code.
The rest of the lines of code are not executed. It is quite strange.
3. Can not exit from the camera
The camera is keeping moving and working. After closing the script with jupyter notebook, I still can not exit from the camera. The camera is showing my face until turning off the computer.