You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Again i want to thank you for making your code available.
I am posting my problems not as a complained but to hopefully help towards a stable version.
I am trying to make this rPPG heart beat detection working with your p5 opencv implementation. https://github.com/prouast/heartbeat-js
The original heartbeat-js works and does NOT crash after running for a few minutes.
But when i use p5.js-cv i get the bellow crash message after a couple of minutes.
i am defining a polygon area in the camera image
then create a mask mat
get the average color
then it is being send through a bunch of PPG functions to find the person heart beat.
The crash happens in 'cv.split(a_signal, s);' inside 'function detrend(a_signal, lambda)'
Maybe you have seen something similar before.
Thanks a bunch.
014602b2:0x8aec7 Uncaught RuntimeError: function signature mismatch
at <anonymous>:wasm-function[1778]:0x8aec7
at <anonymous>:wasm-function[2040]:0xb357a
at <anonymous>:wasm-function[2455]:0xdcc39
at <anonymous>:wasm-function[640]:0x1b4f7
at <anonymous>:wasm-function[875]:0x27ae0
at dynCall_viii (<anonymous>:wasm-function[9632]:0x4840ad)
at Module.dynCall_viii (http://127.0.0.1:56289/libs/opencv.js:9107:46)
at dynCall_viii_918 (eval at makeDynCaller (http://127.0.0.1:56289/libs/opencv.js:1:1), <anonymous>:4:12)
at Object.split (eval at new_ (http://127.0.0.1:56289/libs/opencv.js:6901:29), <anonymous>:9:1)
at detrend (http://127.0.0.1:56289/heartbeat.js:370:8)
The text was updated successfully, but these errors were encountered:
i tried a few things, all of which did not help but they caused the console to report the crash at different lines. this kind of suggests a memory leak.
used the online opencv.js via <script language="javascript" type="text/javascript" src="https://docs.opencv.org/master/opencv.js"></script>
commented out // detrend(a_signal, fps);
commented out all // p5.cv.drawMat
But then i noticed how very often .delete() is used by the original code.
so i looked around for cv.Mats that i do not delete and constantly redefine.
cleaning that up seems to have solved it.
for example mask = cv.Mat.zeros(videoHeight, videoWidth, cv.CV_8UC1); was called on every frame.
Thank you for contributing such well documented issues.
Indeed I believe this point to memory leak and manually calling delete() on Mat instances when done is the way forward.
(There may be other leaks lurking too, but Mat by far will munch on most memory unless managed with delete())
I was pondering on manually cleaning up (for example after drawMat),
but that means I would end up making too many decisions on behalf of the user just to hide this need.
It would also be dificult figuring out when to delete a Mat and especially when not to delete a Mat on behalf of the user behind the scenes.
In terms of API design it is a bit of a tricky one.
I may modify the examples to use delete() and emphasise it's importance.
Again i want to thank you for making your code available.
I am posting my problems not as a complained but to hopefully help towards a stable version.
I am trying to make this rPPG heart beat detection working with your p5 opencv implementation.
https://github.com/prouast/heartbeat-js
The original heartbeat-js works and does NOT crash after running for a few minutes.
But when i use p5.js-cv i get the bellow crash message after a couple of minutes.
Here is a minimal example taking a fixed region of interest polygon and sends it to the PPG functions.
https://www.dropbox.com/s/xjk3je8fpxx0nmy/hand-rppg.zip?dl=0
The crash happens in 'cv.split(a_signal, s);' inside 'function detrend(a_signal, lambda)'
Maybe you have seen something similar before.
Thanks a bunch.
The text was updated successfully, but these errors were encountered: