[RELEASED] OpenCV for Unity

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
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

More Info >>

Release Notes:
2.6.4
[Common] Added various data access methods to the Mat class, including ptr(), at(),
AsSpan(), and AsSpanRowRange().

[Common] Updated get() and set() methods in the Mat
class to support Span and generics, and updated MatUtils.copyFromMat() and
MatUtils.copyToMat() to support Span.

[Common] Added structs and ValueTuples
corresponding to the data formats of basic OpenCV classes, and created overloads for
methods that use these basic classes as arguments, allowing the use of structs and
ValueTuples instead. This update simplifies code, enables more efficient memory usage,
and improves data access speed.

[Common] Added Utils.getFilePathAsyncTask() and
Utils.getMultipleFilePathsAsyncTask() methods. It is an asynchronous Task return version
of the existing Utils.getFilePathsAsync() method. It can be seamlessly integrated with other
asynchronous code.

[Common] Added Utils.texture2DToMatRaw() and
Utils.matToTexture2DRaw() methods.

[Common] Added methods for conversion between
Mat and RenderTexture using ComputeShader (Utils.matToRenderTexture(),
Utils.renderTextureToMat()).

[Common] Added the WebCamTexture2MatAsyncGPUHelper
class.

[Common] Updated the DebugMatUtils class to support displaying Texture2D and
RenderTexture.

[Common] Added a face blurring feature to FaceDetectorYNExample.
[iOS] Fixed an issue where AddToEmbeddedBinaries was processed redundantly with each
incremental build.

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.

2 Likes

is this using native openCV on android or through Java JNI

JNI is only being used to copy the files in the Unity of ”StreamingAssets” folder from ”assets” folder of Android to “/ data / data / ****** / files /” folder.
Other processing is all native openCV.

Thanks. What version of openCV? Does it rely on the opencv manager?

The current version of OpenCV is 2.4.9.
OpenCV Manager does not use. “OpenCV for Unity” uses the OpenCV to static.

Hi,
I would like to draw chin line by myself.
So, can I get chin line or face line with “OpenCV for Unity”.

There is no API to directly detect the face of parts to ”OpenCV for Unity”.
(API Reference OpenCV Java 2.4.9)
You be able to detect the position of the face using the detectMultiScale ().

Hi with this assets i can make an augment reality project?
is there some example in this assets on of how to do based on images recognition?

thx.

2 Likes

Released Version 1.0.4

Version changes
1.0.4
[Common]Add Method matToTexture2D( Mat mat, Texture2D texture2D, Color32[ ] bufferColors = null).

@ bufferColors Optional array to receive pixel data.

  • You can optionally pass in an array of Color32s to use in colors to avoid allocating new memory each frame.
  • The array needs to be initialized to a length matching width * height of the texture (Unity - Scripting API: WebCamTexture.GetPixels32)

Only this asset is difficult, but it can be realized by combining with other asset.

Where I’ve tested, “OpenCV for Unity” worked successfully together with Vuforia.

Please move the “Plugins/x86/opencvforunity.dll” in the same folder as the “QCARWrapper.dll”.

It was successful in image processing using the “OpenCV for Unity” against Texture2D that was acquired from ReadPixels () in OnPostRender ().

Exemple code:
void OnPostRender ()
{
UnityEngine.Rect rect = new UnityEngine.Rect (0, 0, cameraTexture.width, cameraTexture.height);
cameraTexture.ReadPixels (rect, 0, 0, true);
Utils.texture2DToMat (cameraTexture, cameraMat);
Core.transform(cameraMat, cameraMat, mSepiaKernel);
Core.putText (cameraMat, "OpenCV for Unity SEPIA " + cameraTexture.width + “x” + cameraTexture.height, new Point (5, cameraTexture.height - 5), Core.FONT_HERSHEY_PLAIN, 1.0, new Scalar (255, 0, 0, 255));

Utils.matToTexture2D (cameraMat, outputTexture, colors);
}

Please see the screen shot of when running in iPhone5.

Origial Sepia Pixelize

By chance do you have a postbuild script to copy the framework into the xcode project automatically?

You can easily automate By using ”XCodeEditor-for-Unity”.
https://github.com/kyubuns/XCodeEditor-for-Unity

*.projmods example
{
“group”: “OpenCVForUnity”,
“libs”: [ ],
“frameworks”: [ ],
“headerpaths”: [ ],
“files”: [“Editor/iOS/OpenCVForUnity/opencv2.framework”],
“folders”: [ ],
“excludes”: [“^..meta$", "^..mdown^”, “^.*.pdf$”],
“buildSettings”: {
}
}

Released Version 1.0.5

Version changes
1.0.5
[Common] Bug fixes SampleScene.

Is there a way to achieve better fps on lower end android devices? I am trying to make a real time face tracking app using this.

We have purchase the plugin and it works great.
two questions,

  1. are the GPU functions supported? I could not find them
  2. Are you going to support openCV 3.0?

Can speed up the process by adjusting the parameters of the sample scenes.

  • by adjusting the parameters of detectMultiScale ().minSize etc.)
  • Using a smaller size of webCamTexture.

Thank you very much for the answer. Now I’ve encountered another problem, as it’s been set up in the sample scene, opencv can only track WebCamTexture input form one direction (only work on landscape mode, if the camera is upside down or rotated 90 degrees, it wounldn’t work). I know it’s a common issue, but most of the examples I’ve found in the web don’t seen to help much as they are setup in other environments and I am a beginner in opencv and programming.

At this stage I only need it to show correct results in portrait mode.Could you please point me to the right direction to solve this problem or provide more documentations of the asset in the future?

  1. are the GPU functions supported? I could not find them
    GPU functions does not currently support.
    Because “OpenCV Java” does not support GPU functions, I have not decided whether to add the GPU instruction in the future.

  2. Are you going to support openCV 3.0?
    I plan to continue to sequentially version up.

Hi,
looks awesome.
(Have sent you a PM.)

Hi, could you clarify what is going on here ^^^. Unity docs say to use WWW to read files in StreamingAssets (because they are in jar), then it sounds like you are writing the contents elsewhere? Is this done during construction of the cascadeclassifier?

I ask because xml’s used by cascade classifiers tend to be really large and for whatever reason they are not compressed in apk. I’d like to compress them but I don’t really see a way to do this and have it work with your plugin.

Thanks