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
But the app crashes after running for a while at cv.split(a_signal, s); line.
Would you have any idea why that might be?
It's interesting that step variable in the console says "Exception: TypeError" when usually it is 2.
// Remove trend in a_signal
function detrend(a_signal, lambda) {
let h = cv.Mat.zeros(a_signal.rows-2, a_signal.rows, cv.CV_32FC1);
let i = cv.Mat.eye(a_signal.rows, a_signal.rows, cv.CV_32FC1);
let t1 = cv.Mat.ones(a_signal.rows-2, 1, cv.CV_32FC1)
let t2 = cv.matFromArray(a_signal.rows-2, 1, cv.CV_32FC1,
new Array(a_signal.rows-2).fill(-2));
let t3 = new cv.Mat();
t1.copyTo(h.diag(0)); t2.copyTo(h.diag(1)); t1.copyTo(h.diag(2));
cv.gemm(h, h, lambda*lambda, t3, 0, h, cv.GEMM_1_T);
cv.add(i, h, h, t3, -1);
cv.invert(h, h, cv.DECOMP_LU);
cv.subtract(i, h, h, t3, -1);
let s = new cv.MatVector();
console.log({a_signal});
cv.split(a_signal, s); //crash here
console.log({s});
cv.gemm(h, s.get(0), 1, t3, 0, s.get(0), 0);
cv.gemm(h, s.get(1), 1, t3, 0, s.get(1), 0);
cv.gemm(h, s.get(2), 1, t3, 0, s.get(2), 0);
cv.merge(s, a_signal);
h.delete(); i.delete();
t1.delete(); t2.delete(); t3.delete();
s.delete();
}
The text was updated successfully, but these errors were encountered:
Thank you for also making this javascript version of your C++ code. It's awesome.
I ran your JS code successfully but am trying now to combine it with a handpose tracker in order to see if i can get a BPM from the palm of my hand.
I am using this opencv.js helper for my p5js project.
https://github.com/orgicus/p5.js-cv#installation
But the app crashes after running for a while at
cv.split(a_signal, s);
line.Would you have any idea why that might be?
It's interesting that
step
variable in the console says "Exception: TypeError" when usually it is 2.The text was updated successfully, but these errors were encountered: