I am trying to integrate Opencv.js to React(TypeScript). What I did is:
Put
<script async src="https://docs.opencv.org/master/opencv.js" type="text/javascript"></script>
to index.html. And call it as global. I wrote
declare global {
interface Window { cv: any; }
}
window.cv = window.cv || {};
const cv = window.cv;
in react component which I want to use opencv.js.
Therefore, I solved the error "Cannot find name 'cv'." However, I am facing "TypeError: cv.Mat is not a constructor" when I use
let dst = new cv.Mat();
How could I correctly use opencv.js with React ?