简体   繁体   中英

How to use an OpenCV C++ project in the web?

I'm developing an interactive OpenCV application which involves the following: 1. User stylus input, 2. Image processing in the background to detect shapes, 3. Interactive image overlay 4. Displaying updated images using imshow I want to port this to web. I see the following options:

(i) use nodejs with cpp call but this would only work on a local server unless I choose to create an addon (this seems much harder)

(ii) Use a C++ web framework and write from scratch. Wt, silicon are some options. Wt is heavy seems to be the general opinion.

(iii) ... something I haven't listed above and hopefully much easier?

Well the question you should ask yourself is: Do you want to perform the CV tasks in the backend/ your server and stream or send the images to the server for processing or do you want the client to do the heavy lifting?

If you want to implement it as Service then you can use existing npm packages that provide javascript bindings to the OpenCV C++ library, which you have to set up on your Server or simply run it in a docker container.

If you want the client to do all the processing you can use one of the above mentioned packages with electron to create a UI, but the client still has to have OpenCV installed on his system. In case you want to use it in a browser, then you either have the options of using a pure javascript implementations of OpenCV, which will significantly lack performance of expensive CV tasks however, or to use the web assembly package of OpenCV. The web assembly package is asm.js though, I am not sure about the performance and browser support of that one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM