thearn / webcam-pulse-detector

A python application that detects and highlights the heart-rate of an individual (using only their own webcam) in real-time.
Other
3.14k stars 592 forks source link

added video processing support with automatic tracking start\reset #49

Open Serhiy-Shekhovtsov opened 6 years ago

Serhiy-Shekhovtsov commented 6 years ago
connormeaton commented 4 years ago

@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.

Serhiy-Shekhovtsov commented 4 years ago

@cmeaton do you have the same issue when running my fork?

connormeaton commented 4 years ago

@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?

Serhiy-Shekhovtsov commented 4 years ago

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