diff --git a/src/Opencv/templateMatching.js b/src/Opencv/templateMatching.js index f2a14b7..82da044 100644 --- a/src/Opencv/templateMatching.js +++ b/src/Opencv/templateMatching.js @@ -95,7 +95,7 @@ export const findMatch = (cv) => (template, image) => { let colorRed = new cv.Scalar(255, 100, 200, 255); cv.putText(image, "" + numberPoint, new cv.Point(10, 30), cv.FONT_HERSHEY_SIMPLEX, 1.0, colorRed, 1, cv.LINE_AA); - if(maxPoint.x > 0 && maxPoint.y > 0) { + if(maxPoint.x > 0 && maxPoint.y > 0 && Math.abs(maxPoint.x - point1.x) < 20 && Math.abs(maxPoint.y - point1.y) < 20 ) { const lineSize = average < 0.1 ? 1 : parseInt(average * 10, 10); //console.log("lineSize") //console.log(lineSize) diff --git a/src/TemplateVideo.stories.jsx b/src/TemplateVideo.stories.jsx index eab92fc..ad1570d 100644 --- a/src/TemplateVideo.stories.jsx +++ b/src/TemplateVideo.stories.jsx @@ -48,7 +48,7 @@ const transformImage = (stateImgCvTemplateResized, imgDescription) => { try { console.log("result", result); - if (result && result?.goodMatchSize > state.confidenceRate -50 ) { + if (result && result?.goodMatchSize > state.confidenceRate -30 ) { const bestOutput = toImageBase64(cv)(imgCv); const newState = { ...state,