简体   繁体   English

如何在网络上使用OpenCV C ++项目?

[英]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. 我正在开发一个交互式OpenCV应用程序,该应用程序涉及以下内容:1.用户笔输入,2.在后台进行图像处理以检测形状,3.交互式图像覆盖4.使用imshow显示更新的图像我想将此移植到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) (i) 通过cpp调用使用nodejs,但这只能在本地服务器上运行,除非我选择创建插件(这似乎要困难得多)

(ii) Use a C++ web framework and write from scratch. (ii)使用C ++ Web框架并从头开始编写。 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? (iii)...我上面没有列出的东西,希望会更容易吗?

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? 好了,您应该问自己的问题是:您是否要在后端/服务器中执行CV任务,并将图像流式传输或发送到服务器以进行处理,还是希望客户端进行繁重的工作?

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. 如果要将其作为服务实现,则可以使用现有的npm软件包,这些软件包提供与OpenCV C ++库的javascript绑定,您必须在服务器上进行设置或仅在docker容器中运行它。

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. 如果您希望客户进行所有处理,则可以使用上述带有电子程序的软件包之一来创建UI,但是客户仍然必须在其系统上安装OpenCV。 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. 如果要在浏览器中使用它,则可以选择使用OpenCV的纯javascript实现,但是这将大大缺乏昂贵的CV任务的性能,或者可以使用OpenCV的Web程序包。 The web assembly package is asm.js though, I am not sure about the performance and browser support of that one. Web程序包是asm.js,但我不确定该程序的性能和浏览器支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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