Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Sep 7, 2023
1 parent 845562b commit 1b6db2a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/SlightCapture/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,17 @@ const captureAsync = (cv) => async (name,
}

let frameCounter = 0;

let imageSourceClone = null;
async function processVideo(videoCapture, src) {
videoCapture.read(src);
const imageSourceClone = src ;//.clone();
if(imageSourceClone === null && src.cols > 0 && src.rows > 0) {
imageSourceClone = new cv.Mat(src.rows, src.cols, cv.CV_8UC4);
}
src.copyTo(imageSourceClone);
//const imageSourceClone = src ;//.clone();

if(frameCounter%90===0) {
if(frameCounter%10===0) {
console.log("processVideo" + frameCounter);
const applyTemplateMatchingResult = await applyTemplateMatching(cv)(templateMatchingImage, imageSourceClone);
processVideoCache.imageCv = applyTemplateMatchingResult.imageCv;
processVideoCache.targetPoints = applyTemplateMatchingResult.targetPoints;
Expand All @@ -335,9 +340,11 @@ const captureAsync = (cv) => async (name,
if (frameCounter > 0) {
frameCounter = 0;
}
frameCounter++;
}
else{
frameCounter++;
console.log("processVideo++" + frameCounter);
processVideoCache.imageCv = null;
}
const { imageCv, autoAdjustBrightnessRatio, currentPoints, targetPoints } = processVideoCache;
Expand Down

0 comments on commit 1b6db2a

Please sign in to comment.