How to integrate OpenCV.js in a React WebApp?

I'm new to Javascript and React. I would like to embed OpenCV.js into a basic React.js web app to build an online client-side document scanner (I already have the image processing pipeline developped in Python).

I used yarn create react-app to get a basic working React sandbox containing : App.js which is the main React component and index.js which plugs it into the DOM. I added a custom imageProcessing.js file that will contain my image processing pipeline. A yarn start command is available to compile everything and display the result in my browser.

In order to use OpenCV in this pipeline, I downloaded opencv.js from official page, put it next to imageProcessing.js and finally called it through const cv = require('../lib/opencv'). The problem is the yarn start command compiles sources for hours and it is clearly not possible to develop anything.

Now my question is : how to efficiently compile my web app with that heavy opencv.js (13MB) in my sources ? Is their a better way of integrating the lib ?

Thanks for your help !

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.