简体   繁体   English

如何在 reactjs 项目中集成 openCV?

[英]How do I integrate openCV in reactjs project?

I'm working on a reactjs project for a few months now one module requires some image processing.我在 reactjs 项目上工作了几个月,现在一个模块需要一些图像处理。 So, I would like to know how can I integrate openCV with reactjs.所以,我想知道如何将 openCV 与 reactjs 集成。 I can't find any articles, documentations for the same.我找不到任何相同的文章和文档。

Have you tried to implement TensorFlow models instead of openCV to your ReactJS project?您是否尝试在您的 ReactJS 项目中实施 TensorFlow 模型而不是 openCV?

Try checking out TensorFlow.js(website: https://www.tensorflow.org/js ) They have JavaScript compatible CV models. Try checking out TensorFlow.js(website: https://www.tensorflow.org/js ) They have JavaScript compatible CV models. Maybe that's easier to implement than openCV.也许这比 openCV 更容易实现。

I have completed several projects with TensorFlow.js and ReactJS.我已经用 TensorFlow.js 和 ReactJS 完成了几个项目。 They work fine together.他们一起工作得很好。

You can use opencv.js for this.您可以为此使用 opencv.js。 Unfortunately there isn't any NPM packages.不幸的是,没有任何 NPM 包。 However you can import it the same way as you would with an NPM package.但是,您可以像使用 NPM package 一样导入它。 Just in this case you need to manually download and add opencv.js to your project.只是在这种情况下,您需要手动下载 opencv.js 并将其添加到您的项目中。

However, opencv.js is huge so I would recommend using a CDN for it.但是,opencv.js 很大,所以我建议使用 CDN。

Here is a link for the NodeJS tutorials of the documentation: https://docs.opencv.org/3.4/dc/de6/tutorial_js_nodejs.html这是文档的 NodeJS 教程的链接: https://docs.opencv.org/3.4/dc/de6/tutorial_js_nodejs.ZFC35FDC70D5FC69D269883A822C75A

Further more I would not recommend it on a frontend application.此外,我不建议在前端应用程序上使用它。 Because of the size and computational power it needs.因为它需要的大小和计算能力。 You could set up a backend API for it with NodeJS您可以使用 NodeJS 为它设置一个后端 API

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

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