FaceSwapper Example 1.0.4 is now available.
- Author: Enox Software
- Category: News
- Tags: OpenCV for Unity
Related posts
Mat Basic Processing2
These codes are included in the OpenCVForUnity Example Unity scenes. (MatBasicProcessingExample) Shallow copy and deep copy Example Code: Execution Result: mat1=[1, 2, 3; 4, 5, 6; 7, 8, 9] m_shallow=[1, 2, 3; 4, 5, 6; 7, 8, 9] m_deep1=[1, 2, 3; 4, 5, 6; 7, 8, 9] m_deep2=[1, 2, 3; 4, 5, 6; 7, 8, 9] mat1=[100, 2, 3; 4, 5, 6; 7, 8, 9] m_shallow=[100, 2, 3; 4, 5, 6; 7, 8, 9] m_deep1=[1, 2, 3; 4, 5, 6; 7, 8, 9] m_deep2=[1, 2, 3; 4, 5, 6; 7, 8, 9] mat1.Equals(m_shallow)=True mat1.Equals(m_deep1)=False mat1.Equals(m_deep2)=False Merge Example Code: Execution Result: m_merged=[1, 1.1, 1.2, 2, 2.1, 2.2; 3, 3.1, 3.2, 4, 4.1, 4.2] MixChannels Example Code: Execution Result: m_mixed1=[1, 1.1, 2, 2.1; 3, 3.1, 4, 4.1] m_mixed2=[1.2, 1.1, 2.2, 2.1; 3.2, 3.1, 4.2, 4.1] Split Example Code: Execution Result: [1, 4, 7; 10, 13, 16] [2, 5, 8; 11, 14, 17] [3, 6, 9; 12, 15, 18] Reduce Example Code: Execution Result: m1=[1, 5, 3; 4, 2, 6; 7, 8, 9] v1(sum)=[12, 15, 18] v2(avg)=[4, 5, 6] v3(min)=[1, 2, 3] v4(max)=[7, 8, 9] m1=[1, 5, 3; 4, 2, 6; 7, 8, 9] v1(sum)=[9; 12; 24] v2(avg)=[3; 4; 8] v3(min)=[1; 2; 7] v4(max)=[5; 6; 9] RandShuffle Example Code: Execution Result: m1(original)=[1, 2, 3, 4, 5; 6, 7, 8, 9, 10; 11, 12, […]
- Author: Enox Software
- Category: Tips
- Tags: OpenCV for Unity
How to catch native OpenCV’s errors code (CVException handling)
In order to display the native opencv’s error code, please enclose the code in Utils.setDebugMode(true) and Utils.setDebugMode(false). Example Code: // // CVException handling example // // 32F, channels=1, 3×3 Mat m1 = new Mat (3, 3, CvType.CV_32FC1); m1.put (0, 0, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); // 8U, channels=1, 3×3 Mat m2 = new Mat (3, 3, CvType.CV_8UC1); m2.put (0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); // dump Debug.Log (“”m1=”” + m1); Debug.Log (“”m1.dump()=”” + m1.dump ()); Debug.Log (“”m2=”” + m2); Debug.Log (“”m2.dump()=”” + m2.dump ()); #if UNITY_STANDALONE || UNITY_EDITOR // Publish CVException to Debug.LogError. Utils.setDebugMode (true, false); Mat m3 = m1 / m2; Utils.setDebugMode (false); // Throw CVException. Utils.setDebugMode (true, true); try { Mat m4 = m1 / m2; } catch (Exception e) { Debug.Log (“”CVException: “” + e); } Utils.setDebugMode (false); #else Debug.Log (“”The setDebugMode method is only supported on WIN, MAC and LINUX.””); #endif Execution Result: m1=Mat [ 3*3*CV_32FC1, isCont=True, isSubmat=False, nativeObj=0x820637680, dataAddr=0x820295296 ] m1.dump()=[1, 2, 3; 4, 5, 6; 7, 8, 9] m2=Mat [ 3*3*CV_8UC1, isCont=True, isSubmat=False, nativeObj=0x820637792, dataAddr=0x820619712 ] m2.dump()=[ 1, 2, 3; 4, 5, 6; 7, 8, 9] core::divide_12() : OpenCV(3.4.1-dev) C:\Users\xxxxx\Desktop\opencv\modules\core\src\arithm.cpp:683: error: (-5) When the input arrays in add/subtract/multiply/divide functions have different types, the output array type must be explicitly specified in function cv::arithm_op m3=Mat [ […]
- Author: Enox Software
- Category: Tips
- Tags: OpenCV for Unity
OpenCV for Unity ver2.4.4 Release!
Version 2.4.4 [Common]Updated to OpenCV4.5.2. [Common]Added VideoCaptureCameraInputExample and BackgroundSubtractorComparisonExample. [Common]Updated TrackingExample.
- Author: Enox Software
- Category: Update
- Tags: OpenCV for Unity