OpenCVForUnity学习教程——1

本文提供Unity集成OpenCV的详细步骤,包括环境配置、不同平台的设置方法及常见问题解决方案,适用于Unity2018.2.0f2版本。

本文仅作为个人学习记录过程,请勿催更,本系列教程仅为个人理解,不具备权威性,仅供参考。PS:转载请注明出处:https://www.jianshu.com/p/09d93a7cc3ed

首先官方下载地址,有条件的可以支持一下:https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088

没有条件的出门左拐csdn或其他论坛网站都有。csdn地址:https://download.youkuaiyun.com/download/qq_25164763/10731464

什么?你连csdn积分都没有?好吧伸手党:百度盘链接(链接丢失概不负责):https://pan.baidu.com/s/1LsSGSvefXyAIKKV5aoCFrg提取码:fsft

本文环境:

Unity2018.2.0f2破解版

OpenCVForUnity 2.3.0版本


1.导入unitypackage包后,点击上方MenuItem [Tools / OpenCV for Unity / Set Plugin Import Settings]插件会自动配置运行环境。

2.将包内的StreamingAssets文件夹拖到Assets文件夹下。

3.ios导出时需要设置[PlayerSettings]-[Other Settings]-[Configuration]-[Camera Usage Description],写一下请求相机权限的文字,如果此处不写就要在Xcode工程自行添加了。

4.如果Unity的版本低于2017.2,则必须手动将opencv2.framework拖入framework引用。

5.[Windows10 UWP]如果使用webCamTextue类,[PlayerSettings]-[PublishingSettings]-[Capabilities]中WebCam打上勾。

6.别忘了把所有场景添加上去

7.Android设置“OpenCVForUnity/Plugins/libs/armeabi-v7a/*.so” – 选择 Android 和 CPU ARMv7。OpenCVForUnity/Plugins/libs/x86/*.so– 选择 Android 和CPU x86。

8.如果不使用opencv_contrib模块,则使用将减少构建大小。

安卓设置步骤:1.将OpenCVForUnity / Plugins / Android / libs文件夹替换为 OpenCVForUnity / Extra / exclude_contrib / Android / libs文件夹。 

2.选择MenuItem [Tools / OpenCV for Unity / Set Plugin Import Settings]。 

3.删除OpenCVForUnity / Assets / OpenCVForUnity / org / opencv_contrib 文件夹和OpenCVForUnity / Examples / ContribModules文件夹。

iOS 设置步骤:1. OpenCVForUnity/Plugins/iOS/libopencvforunity.a选择ios

2. OpenCVForUnity/Plugins/iOS/opencv2.framework选择ios

9.导出ipa文件时,需要删除 opencv2.framework

10.Win也一样(MAC同理)“OpenCVForUnity/Plugins/Windows/x86/opencvforunity.dll”打上勾

“OpenCVForUnity/Plugins/Windows/x86_64/opencvforunity.dll”打上勾

11.WebGL等参照手册吧,另手册中还记录了诸多ios报错原因,请自行参阅。


Works with Unity Cloud Build iOS & Android support Windows10 UWP support WebGL support Win & Mac & Linux Standalone support Preview support in the Editor OpenCV for Unity is an Assets Plugin for using OpenCV 3.4.2 from within Unity. Official Site | ExampleCode | Android Demo WebGL Demo | Tutorial & Demo Video | Forum | API Reference | Support Modules Features: - Since this package is a clone of OpenCV Java, you are able to use the same API as OpenCV Java 3.4.2 (link). - You can image processing in real-time by using the WebCamTexture capabilities of Unity. (real-time face detection works smoothly on iPhone 5) - Provides a method to interconversion of Unity's Texture2D and OpenCV's Mat. - IDisposable is implemented in many classes.You can manage the resources with the “using” statement. - Examples of integration with other publisher assets are available.(e.g. PlayMaker, NatCam, NatCorder) ExampleCode using OpenCV for Unity is available. MarkerBased AR Example MarkerLess AR Example FaceTracker Example FaceSwapper Example FaceMask Example RealTime FaceRecognition Example GoogleVR with OpenCV for Unity Example Kinect with OpenCV for Unity Example AVPro with OpenCV for Unity Example HoloLens with OpenCV for Unity Example PlayMakerActions for OpenCVforUnity NatCam with OpenCVForUnity Example NatCorder with OpenCVForUnity Example OpenCV for Unity uses OpenCV under 3-clause BSD License; see Third-Party Notices.txt file in package for details. System Requirements Build Win Standalone & Preview Editor : Windows 7 or later Build Mac Standalone & Preview Editor : OSX 10.9 or later
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值