OpenCV for Unity
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
Requires 2021.3.35f1 or higher.
OpenCV for Unity is an Assets Plugin for using OpenCV from within Unity cross-platform game engine.
Official Site | ExampleCode | Android Demo WebGL Demo | Product Introduction Video Setup Guide Video | Forum | API Reference | Support Modules | Free Trial Version
OUR ASSET FEATURES
- Cross Platform
Compatible with multiple platforms, allowing for app development on major platforms.
iOS & Android & Windows10 UWP support.
Win & Mac & Linux Standalone support.
WebGL support.
ChromeOS support.
Support for preview in the Editor.
Works with Unity Cloud Build.
- Support Latest Version
Users can utilize âOpenCV for Unityâ based on the latest version of OpenCV (4.10.0) for app development.
- OpenCV Java API Supoort
As a clone of OpenCV Java, which means you can use the exact same API as OpenCV Java 4.10.0. OpenCV Java documentation
- Easy to Use
We provide helper functions for the interconversion of Unityâs Texture2D and OpenCVâs Mat. Many classes implement IDisposable, allowing you to manage resources using the âusingâ statement.
- Include Many Examples
Includes a wide variety of example usage scenarios, which consist of scene files and script codes. By running these sample applications, you can learn how to develop OpenCV applications effectively.
OpenCVForUnity Examples (GitHub)
EnoxSoftware repositories (GitHub)
- AR VR MR
Can be utilized for developing applications using Augmented Reality, Virtual Reality, and Mixed Reality technologies.
- Deep Learning
Provides support for the dnn module, including various frameworks such as ONNX, TensorFlow, caffe, Torch, Darknet, and more. See OpenCV wiki (GitHub)
On all platforms, inference in the Dnn module uses the CPU backend by default; only Windows platforms can use the CUDA backend by following additional steps.
- Use of WebCamTexture
Supports input from Unityâs WebCamTexture, allowing you to perform real-time image processing on camera footage.
- Works with many hardware
Compatible with a wide range of hardware gadgets beyond just PCs and smartphones, allowing it to run on various devices.
(e.g. HoloLens1 / Hololens2, Nreal Light, Oculus, Kinect, RealSense, ZED 2 or ZED Mini stereo camera, and Raspberry Pi).
- Visual Scripting Support
By utilizing the VisualScripting With OpenCVForUnity Example, you can leverage all the methods available in OpenCVforUnity within the Unityâs Visual Scripting development environment.
VisualScripting With OpenCVForUnity Example (GitHub)
Trial & Demo:
ExampleCode using OpenCV for Unity is available.
MarkerBased AR Example
MarkerLess AR Example
FaceTracker Example
FaceSwapper Example
FaceMask Example
RealTime FaceRecognition 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
VisualScripting with OpenCVForUnity Example
ARFoundation with OpenCVForUnity Example
NrealLight with OpenCVForUnity Example
FfmpegWithOpenCVForUnityExample
VideoPlayerWithOpenCVForUnityExample
NativeGalleryWithOpenCVForUnityExample
OpenCV for Unity uses OpenCV under Apache 2 license; see Notices.txt file in package for details.
System Requirements:
Build Win Standalone & Preview Editor : Windows8 or later
Build Mac Standalone & Preview Editor : OSX 10.13 or later
Build Linux Standalone & Preview Editor : Ubuntu18.04 or later
Build Android : API level 24 or later
Build iOS : iOS Version 11.0 or later
Release Notes:
2.6.3
[Common]Fixed CountFingersExample.
[Windows][UWP]Fixed native library build settings for ARM64 architecture.
2.6.2
[Common]Changed the minimum supported version to Unity2021.3.35f1.
[Common]Added AsyncGPUReadback2MatHelper.
[Common]Updated MultiSource2MatHelperExample.
[Common]Separated the examples using the Built-in Render Pipeline and Scriptable Render Pipeline.
[Common]Fixed a memory leak in Converters.cs.
2.6.1
[Common]Updated to OpenCV4.10.0.
[Common]Added MultiSource2MatHelperExample.
2.6.0
[iOS]Added separate plugin files for iOS for devices and simulators.
[WebGL]Added plugin files with only simd enabled.
2.5.9
[Common]Added PoseSkeletonVisualizer to HandPoseEstimationMediaPipeExample and PoseEstimationMediaPipeExample.
[Common]Changed to use unsafe code by default.
[Common]Optimized the amount of memory allocation, mainly in the Convertor class.
2.5.8
[Common]Updated to OpenCV4.9.0.
[Common]Added DebugMatUtilsExample and MultiObjectTrackingExample.
[Common]Updated VideoWriterExample, VideoWriterAsyncExample, TextRecognitionCRNNExample, TextRecognitionCRNNWebCamExample and TrackingExample.
[Common]Changed the minimum supported version to Unity2020.3.48f1.
[WebGL]Added support for âWebAssembly 2023â.
[iOS]Changed âTarget minimum iOS Versionâ to 11.0.
[Common]Removed TrackerGOTURN from TrackingExample and added TrackerVit.
2.5.7
[Common]Added FeatureMatchingExample.
[WebGL]Added a plugin file with threads and simd enabled for the WebGL platform. This update removes support for the WebGL platform in Unity 2021.1 and below. (Select MenuItem[Tools/OpenCV for Unity/Open Setup Tools/WebGL Settings])
2.5.6
[Common]Added PoseEstimationMediaPipeExample.
[Common]Updated VideoWriterExample, VideoWriterAsyncExample (support URP and HDRP) .
2.5.5
[Common]Updated to OpenCV4.8.0.
[Common]Added ImageCorrectionExample, YuNetFaceDetectionExample and FaceDetectionYuNetV2Example.
[Common]Updated HumanSegmentationExample, BarcodeDetectorExample. [Windows]Added Support for ARM64.
[WebGL]Added Unity2023.2 or later support.
2.5.4
[Common]Added VideoWriterAsyncExample.
[Common]Updated SimpleBlobExample, HumanSegmentationExample and HandPoseEstimationExample.
2.5.3
[Common]Added HandPoseEstimationExample and FacialExpressionRecognitionExample.
2.5.2
[Common]Added YOLOv4ObjectDetectionExample, YOLOv7ObjectDetectionExample, YOLOXObjectDetectionExample and NanoDetPlusObjectDetectionExample.
[Common]Updated HandPoseEstimationExample, ArUcoExample, ArUcoWebCamExample and ArUcoCameraCalibrationExample.
2.5.1
[Common]Updated to OpenCV4.7.0.
[Common]Added ImageClassificationMobilenetExample and HandPoseEstimationExample.
[Common]Added TrackerNano to TrackingExample.
[Lumin]Removed Lumin platform support (for MagicLeapOne).
[Common]Add a button to SetupTools to automatically add scenes under the âExamplesâ folder to âScenes In Buildâ.
2.5.0
[Common]Added TransformECCExample, HumanSegmentationExample and ImageClassificationPPResnetExample.
[Common]Update TextOCRWebCamExample.
[Common]Changed the setup procedure to use the SetupToolsWindow.
[Common]Change the namespase under âOpenCVForUnity/Editorâ folder from âOpenCVForUnityâ to âOpenCVForUnity.Editorâ.
[Common]Added the ExampleAssetsDownloaderWindow that automatically downloads the necessary files to Examples.
[Common]Added âOpenCVForUnityâ folder under âStreamingAssetsâ folder.
[Common]Added function to automatically move the StreamingAssets folder.
[WebGL]Added Unity2022.2 or later support.
2.4.9
[Common]Added LegacyTrackingExample and LightweightPoseEstimationWebCamExample.
[Common]Renamed âWebCamTextureExampleâ to "WebCamExample.
[WebGL]Fixed plugins for the WebGL platform.
2.4.8
[Common]Updated to OpenCV4.6.0.
[Common]Added KNNExample, PhysicalGreenScreenExample and LightweightPoseEstimationExample.
[Common]Update VideoCaptureToMatHelper, GreenScreenExample and QRCodeDetectorExample.
2.4.7
[Common]Updated to OpenCV4.5.5.
[Common]Added FaceDetectorYNWebCamTextureExample, FaceRecognizerSFExample and QRCodeEncoderExample.
2.4.6
[Common]Updated to OpenCV4.5.4.
[Android]Added Support for ChromeOS (x86 and x86_64 architectures).
2.4.5
[Common]Updated to OpenCV4.5.3.
[Common]Added BarcodeDetectorExample and BarcodeDetectorWebCamTextureExample.
2.4.4
[Common]Updated to OpenCV4.5.2.
[Common]Added
VideoCaptureCameraInputExample and BackgroundSubtractorComparisonExample.
[Common]Updated TrackingExample.
2.4.3
[Common]Added a downloader script to automatically set up the Dnn module example.
[WebGL]Added exclude_contrib version for build size reduction.
2.4.2
[Common]Added Assembly Definitions.
[Common]Fixed LibFaceDetectionV3Example.
2.4.1
[Common]Updated to OpenCV4.5.0.
[Common]Added DaSiamRPNTrackerExample.
2.4.0
[Common]Updated to OpenCV4.4.0.
[Common]Added TextOCRExample.
[Common]Updated YoloObjectDetectionExample ( Yolo v4 ) .
2.3.9
[Common]Updated to OpenCV4.3.0.
[Common]Added LibFaceDetectionV2Example, LibFaceDetectionV3Example, ColorizationExample and DocumentScannerExample.
[Common]Update ArUcoCameraCalibrationExample and WrapPerspectiveExample.
2.3.8
[Common]Updated to OpenCV4.2.0.
[UWP]Added ARM64 Architecture.
[WebGL]Added opencvforunity.bc with multi-threading enabled.
[Common]Added FastNeuralStyleTransferExample and LibFaceDetectionExample.
[Common]Added MatIndexer class and MatUtils class.
[Common]Update ComicFilterExample, VideoCaptureExample, OpenPoseExample and MatBasicProcessingExample.
2.3.7
[WebGL]Fixed build errors that occur when DevelopmentBuild is enabled on the WegGL platform.
[Common]Added optimization code using NativeArray class. ( require PlayerSettings.allowUnsafeCode flag, âOPENCV_USE_UNSAFE_CODEâ ScriptingDefineSymbol and Unity2018.2 or later. )
[iOS]Fixed build errors that occur on the iOS platform with Unity2019.3 or later.
[Common]Updated to WebCamTextureToMatHelper.cs v1.1.1.
2.3.6
[WebGL]Fixed âPlugins/WebGL/2018.2/opencvforunity.bcâ.
[Common]Added multi-dimensional Mat example to MatBasicProcessingExample.
[Common]Fixed ARUtils.cs.
2.3.5
[Common]Updated to OpenCV4.1.0. [Windows, Android]Added dynamic link library version.
2.3.4
[Common]Added MaskRCNNExample.
[WebGL]Added Unity2019.1 or later support.
2.3.3
[Common]Updated to OpenCV4.0.0.
[Common]Re-assined namespace as was classified by module names.
[Common]Updated to WebCamTextureToMatHelper.cs v1.1.0.
[Common]Updated to ImageOptimizationHelper v1.1.0
[Common]Added Utils_GetFilePathExample, FaceMarkExample and QRCodeDetectorExample.
2.3.2
[macOS]Removed 32bit architecture(i386) from opencvforuntiy.bundle.
2.3.1
[Common]Updated to OpenCV3.4.2.
[Android,UWP]Fixed Utils.setDebugMode() method on the IL2CPP backend.
[Common]Added DnnObjectDetectionExample and DnnObjectDetectionWebCamTextureExample.
2.3.0
[iOS]Added a function to automatically remove the simulator architecture(i386,x86_64) at build time.
[Common] Improved OpenCVForUnityMenuItem.setPluginImportSettings() method.
2.2.9
[Linux]Simplified the Linux platform setup procedure.
[Common]Added support for Utils. setDebugMode() method on all platforms.
[Common]Updated to WebCamTextureToMatHelper.cs v1.0.9.
[Common]Added MatToTextureInRenderThreadExample and AlphaBlendingExample.
2.2.8
[Common]Updated to WebCamTextureToMatHelper.cs v1.0.7.
[Common]Added MatBasicProcessingExample.
[Common]Fixed WebCamTextureToMatExample, WebCamTextureToMatHelperExample, ArUcoExample.
[Common]Added flip flag to Utils.fastMatToTexture2D() method and Utils.fastTexture2DToMat() method.
[Common]Added throwException flag to Utils.setDebugMode() method.
2.2.7
[Common]Updated to OpenCV3.4.1.
[Common]Added OpenPoseExample(The model file is not included in this asset.), KalmanFilterExample, ArUcoCameraCalibrationExample.
[Common]Fixed VideoWriterExample, VideoCaptureExample, ImwriteScreenCaptureExample, CamShiftExample, TrackingExample, HandPoseEstimationExample, ArUcoCreateMarkerExample, ArUcoExample, ArUcoWebCamTextureExample.
[Common] Updated to WebCamTextureToMatHelper.cs v1.0.6.
2.2.6
[Android]Added arm64-v8a Architecture.
[Common]Added ImwriteScreenCaptureExample.
2.2.5
[Common] Updated to WebCamTextureToMatHelper.cs v1.0.4.
[Common] Fixed MobileNetSSDExample and MobileNetSSDWebCamTextureExample.
2.2.4
[Common]Updated to OpenCV3.3.1.
[Common]Added ResnetSSDFaceDetectionExample, YoloObjectDetectionExample, YoloObjectDetectionWebCamTextureExample.
2.2.3
[Common]Updated to WebCamTextureToMatHelper.cs v1.0.3.
[iOS]opencv2.framework is changed from static framework to embededd framework. (Target minimum iOS Version must be set to 8.0 or higher.)
2.2.5
[Common] Updated to WebCamTextureToMatHelper.cs v1.0.4.
[Common] Fixed MobileNetSSDExample and MobileNetSSDWebCamTextureExample.
2.2.4
[Common]Updated to OpenCV3.3.1.
[Common]Added ResnetSSDFaceDetectionExample, YoloObjectDetectionExample, YoloObjectDetectionWebCamTextureExample.
2.2.3
[Common]Updated to WebCamTextureToMatHelper.cs v1.0.3.
[iOS] opencv2.framework is changed from static framework to embededd framework. (Target minimum iOS Version must be set to 8.0 or higher.)
2.2.2
[Common]Added TextRecognitionExample.
2.2.1
[Common]Updated to OpenCV3.3.0.
[Common]Added dnn module.(win,mac,ios,android platform)
[Common]Added img_hash, reg, text module.(all platform)
[Common]Added MobileNetSSDExample, MobileNetSSDWebCamTextureExample, TensorFlowWebCamTextureExample, ThinPlateSplineShapeTransformerExample, TextDetectionExample, VideoWriterExample.
[Common]WindowsStoreApp8.1 & WindowsPhone8.1 support have been deprecated.
2.0.0
[Common]Updated WebCamTextureToMatHelper.cs v1.0.2
[Common]Improved Utils.getFilePathAsync().
2.1.9
[WebGL]Fixed Utils.getFilePathAsync() method.
2.1.8
[Common]Added PCAExample.
[Common]Updated WebCamTextureToMatHelper.cs and OptimizationWebCamTextureToMatHelper.cs(Changed several method names.).
2.1.7
[Common]Improved Utils.getFilePath() and Utils.getFilePathAsync().
[Common]Improved WebCamTextureAsyncDetectFaceExample.cs.
[Common] Fixed the const value of Calib3d class.
2.1.6
[Common]Fixed fastMatToTexture2D() method.
2.1.5
[Common]Updated to OpenCV3.2.0.
[Common]Added fuzzy, phase_unwrapping, saliency, shape, tracking module.
[Common]Added TrackingSample.
[iOS]Added ios_exclude_contrib.zip for build size reduction.
[Android]Added android_exclude_contrib.zip for build size reduction.
2.1.4
[Common]Changed the scene name.(âSampleâ to âExampleâ)
[Common]Fixed ArUcoTexture2DExample and ArUcoWebCamTextureExample.
[Common]Added ConnectedComponentsExample.
[Common]Added GreenScreenExample.
2.1.3
[UWP]Added OpenCVForUnityUWP_Beta3.zip
2.1.2
[Common]Fixed WebCamTextureToMatHelper.cs.(flipVertical and flipHorizontal flag)
2.1.1
[Common]Fixed OpenCVForUnityMenuItem.cs.(No valid name for platform: 11 Error)
[Common]Added Utils.textureToTexture2D() method. [Common]Added Mat class operators. [Common]Added PolygonFilterSample.
2.1.0
[Common]Fixed WebCamTextureToMatHelper class.
[Common]Added Utils.getVersion().
[Common]Fixed Utils.getFilePathAsync().
2.0.9
[WebGL]Added WebGL(beta) support.(Unity5.3 or later)
2.0.8
[Common]Improved WebCamTextureHelper class.
[Common]Fixed ArUcoSample.
2.0.7
[Common]Added aruco, structured_light, xfeatures2d module.
[Common]Added ArUcoSample, GrabCutSample, InpaintSample, MatchShapesSample, MSERSample.
2.0.6
[WSA]Fixed an issue where Windows App Certification Kit fails.
2.0.5
[Common]Added HOGDescriptorSample.
2.0.4
[Android]Added Support for Split Application Binary (.OBB)
[Android]Removed opencvforunity.jar.
2.0.3
[Common]Added SVMSample.
[Common]Fixed VideoCaptureSample and WebCamTextureAsyncDetectFaceSample.
[UWP]Added OpenCVForUnityUWP_Beta2.zip.
2.0.2
[Common]Fixed CS0618 warnings: UnityEngine.Application.LoadLevel(string)' is obsolete:
Use SceneManager.LoadSceneâ.
2.0.1
[OSX]Fixed SIGILL Exception.
[Common]Added Utils.setDebugMode() method.
[Common]Added MatchTemplateSample, StereoBMSample, SeamlessCloneSample and WebCamTextureDetectCirclesSample.
[Common]Added flipVertical flag, flapHorizontal flag and GetWebCamDevice() method to WebCamTextureToMatHelper.cs.
[Common]Excluded Old Version based on âOpenCV 2.4.11â.(In order to reduce the package size)
2.0.0
[Common]Updated to OpenCV3.1.0.
[Common]Included Old Version based on âOpenCV2.4.11â.
[Common]Included Beta Version of Windows10 UWP Support.(This is beta version based on OpenCV3.0.0. opencv_contrib modules is not supported.)
1.3.2
[iOS]Fixed libopencvforunity.a Bitcode Setting.
[Common]Added Beta16 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.3.1
[Common]Fixed WebCamTextureToMatHelper.cs.(Add didUpdateThisFrame () method)
[Common]Added Beta15 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.3.0
[Common]Fixed WebCamTextureToMatHelper.cs.( Bug of rotation convertion from WebCamTexture to Mat in Win,Mac StandAlone Build)
[Common] Added Beta14 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.2.9
[Common]Added fastTexture2DToMat() and fastMatToTexture2D().
[Common] Renewed the samples using WebCamTextureToMatHelper.(Supports all screen orientation.)
[Common] Added Beta13 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.2.8
[iOS]Fixed malloc_error that occurs in Unity5.3.1p2.
[Common]Added Beta12 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.2.7
[Common] Added Beta11 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â(Added mjpeg format support in VideoCapture class).
1.2.6
[iOS]Enabled Bitcode.
[Common] Added Beta10 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
1.2.5
[Common] Added Beta9 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.( Added support for Windows10 UWP.This is a test version. opencv_contrib modules is not supported.)
1.2.4
[Common]Fix FaceRecognizerSample.
[Common] Delete the method using Default parameter specifiers.
1.2.3
[Common] Add Beta7Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â.
[Common]Add WrapPerspectiveSample,HandPoseEstimationSample,MultiObjectTrackingBasedOnColorSample.
1.2.2
[iOS]Move âOpenCVForUnity/ iOSforXcode/opencv2.frameworkâ to âOpenCVForUnity/Plugins/iOS/âfolder.
[iOS]Fix WebCamTexture bug of SampleScene in Unity5.2.
1.2.1
[Common] Add Beta5 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â(Add Linux support).
[Common]Rewrite SampleScene.
1.2.0
[Common]Add Utils. getGraphicsDeviceType().
[Common]Add SampleScene Setup Tutorial Video for Unity5.
1.1.9
[Common]Add CamShiftSample.(Object Tracking)
[Common]Add OpenCVForUnityMenuItem.cs.( This script set plugin import settings automatically from MenuItem.)
1.1.8
[iOS] Fix problem when working with Metaio(UnityAppController problem).
[iOS] Change file name from âOpenCVForUnity/Plugins/iOS/MyAppController.mmâ to âOpenCVForUnity/Plugins/iOS/OpenCVForUnityAppController.mmâ.
[Common] Add [System.Serializable] to basic class.
[iOS]Move âOpenCVForUnity/ iOSforXcode/iOS_BuildPostprocessor.csâ to âOpenCVForUnity/Editorâfolder.
[Common] Add Beta2 Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â(support Unity5).
1.1.7
[Common] Update to OpenCV2.4.11.
[Common] Add Beta Version of âOpenCV for Untiyâ based on âOpenCV3.0.0â(support Unity5).
1.1.6
[Common]Fix FaceRecognizer.cs(Compile Error had happened only in the case of Unity4 Non Pro License).
1.1.5
[Common]Add Beta Version of âOpenCV for Untiyâ based on âOpenCV3.0.0-rc1â(support Unity5).
[Android]Fix Utils.getFilePath().
[Common]Add WebCamTextureAsyncDetectFaceSample.
[iOS]Change folder name from âOpenCVForUnity/iOS for Xcode/â to âOpenCVForUnity/iOSforXcode/â.Add iOS_BuildPostprocessor.cs.
1.1.4
[Common]Add FaceRecognizer subclass.
[Common]Add FaceRecognizerSampleScene.
[Common]Fix SampleScene.
1.1.3
[Common]Fix SampleScene.
[Common]Change Property of Platform Dependent Compilation from UNITY_IPHONE to UNITY_IOS.
1.1.2
[Common]Fix the direction of rotation of the mat that is converted from WebCamTexture.
1.1.1
[Common]Add OpticalFlowSampleScene.
[Common]Fix SampleScene.
[Common]Fix function name of CvANN_MLP_TrainParams class.
1.1.0
[Common]Divide asset for Unity4 and Unity5.
1.0.9
[Common]Support for Unity5.
1.0.8
[Common]Update to OpenCV2.4.10
1.0.7
[iOS]Support for arm64 build target.(Unity 4.6.1p3 or higher)
[Common]Add Constructor VideoCapture(string filename).(Support for Win,Mac,iOS)
[Common]Add Method copyToMat(),copyFromMat().
1.0.6
[Android]Support for x86 build target.(Unity 4.6 or higher)
1.0.5
[Common] Bug fixes SampleScene.
1.0.4
[Common]Add Method matToTexture2D( Mat mat, Texture2D texture2D, Color32[ ] bufferColors = null).
1.0.3
[Common]Support for preview in the Editor.(Pro only)
[Common]Support for Win & Mac Standalone.(Pro only)
[Android]Change of location of the file that you want to use for Utils.getFilePath().Changed to useâAseets/StreamingAssets/â folder.
[iOS] Add the file that you want to use for Utils.getFilePath() to Xcode project is no longer required.Changed to useâAseets/StreamingAssets/â folder.