webcam-pulse-detector
webcam-pulse-detector copied to clipboard
added video processing support with automatic tracking start\reset
- Tracking starts automatically when face is stable for N seconds.
- Tracking restarts automatically when face is not detected for some time or if it moves out of the range.
- The face frame is stabilized for better performance.
- Added a video processing example in
get_pulse_from_video.py
@Serhiy-Shekhovtsov When I run get_pulse_from_video.py I get this error:
Traceback (most recent call last):
File "get_pulse_from_video.py", line 214, in <module>
print([int(val) for val in App.processor.results])
AttributeError: 'findFaceGetPulse' object has no attribute 'results'
Any ideas how to fix? Thank you.
@cmeaton do you have the same issue when running my fork?
@Serhiy-Shekhovtsov Hmm, it all of a sudden runs now, but breaks quickly. It shows a video I recorded from my webcam (.mov) for a few seconds then crashes with this error:
Traceback (most recent call last):
File "get_pulse_from_video.py", line 211, in <module>
App.main_loop(frame)
File "get_pulse_from_video.py", line 167, in main_loop
self.make_bpm_plot()
File "get_pulse_from_video.py", line 124, in make_bpm_plot
bg=self.processor.slices[0])
File "/Users/asi/connor_asi/webcam-pulse-detector/webcam-pulse-detector/lib/interface.py", line 72, in plotXY
bg = cv2.resize(bg,(wd,int(h)))
cv2.error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/resize.cpp:4048: error: (-215:Assertion failed) inv_scale_x > 0 in function 'resize'
This happens right after the pulse function (dark green box) starts on the video. It also takes ~10 seconds of video time before the pulse function starts counting down to start. Is this normal?
Not sure what the plotXY
is doing here and why it crashes tbh. As for the delay with counting - it's normal. The app will wait for the face to stabilize and the processing will start when enough data has been collected: https://github.com/Serhiy-Shekhovtsov/webcam-pulse-detector/blob/no_openmdao/lib/processors_noopenmdao.py#L176