Search Unity

[RELEASED] OpenCV for Unity

Discussion in 'Assets and Asset Store' started by EnoxSoftware, Oct 30, 2014.

  1. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    I think the following example will be helpful for matching the frames from a live feed of a webcam.
    MarkerLessARExample
    https://assetstore.unity.com/packages/templates/tutorials/markerless-ar-example-77560
     
  2. ecarbin

    ecarbin

    Joined:
    Mar 16, 2013
    Posts:
    2
    Hello,
    I bought the package and so far have been very impressed! I am wondering if the plugin is able to play well with Jobs or on another worker thread? It is process heavy. I am trying to the markerless AR and track several markers and found that the Orb matching and descriptor brings the app to a halt. Any advice would be appreciated.

    Thanks!
     
  3. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    The following example is a good reference for Mat operations on multi-threads.
    https://github.com/EnoxSoftware/Ope...nchronousFaceDetectionWebCamTextureExample.cs
     
  4. bin223

    bin223

    Joined:
    Sep 5, 2020
    Posts:
    2
    public void OnChangeCameraButtonClick ()
    {
    webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing ();
    }
    I connected two usb cameras on the computer and use this button to switch cameras. In my opinion, this is possible, but it does not work. How can I modify it?
     
  5. calculmentor

    calculmentor

    Joined:
    Jun 25, 2014
    Posts:
    11
    hi there !
    I have some error with the playmaker's actions...all reference seems broken :/

    The type or namespace name 'WebCamTextureToMatHelper' could not be found (are you missing a using directive or an assembly reference?)

    it was working great with older version !
    wonderfull asset , thx
     
  6. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Could you tell me the environment you tested?
    OpenCVForUnity version :
    OpenCVForUnityPlayMakerActions :
    Unity Version :
    Editor Platform :
     
  7. calculmentor

    calculmentor

    Joined:
    Jun 25, 2014
    Posts:
    11
    thx for quick reply !

    API new year BTW !

    so :
    OVC vers : Version 2.4.2 - December 18, 2020
    OCVPM :Version 1.1.2 - December 28, 2020
    Unity 2020.2.1f1
    windows 10
    In fact none of PM actions are working (999+)

    thx !
    nicolas
     
  8. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    When you import OpenCVForUnity, does it include asmdef?
    If it is not included, Could you remove OpenCVForUnity from the PackageManager and re-download it?
    opencv_import.PNG
     
  9. macfry

    macfry

    Joined:
    Sep 17, 2018
    Posts:
    5
    Hello sample works,
    but i would like implement dnn Example with another caffemodel and onnx with the two exmaple libfacedetection...

    when i try another caffemodel and proto... i have this message
    dnn::forward_14() : OpenCV(4.5.0-dev) C:\Users\satoo\Desktop\opencv\modules\dnn\src\layers\fully_connected_layer.cpp:180: error: (-215:Assertion failed) srcMat.dims == 2 && srcMat.cols == weights.cols && dstMat.rows == srcMat.rows && dstMat.cols == weights.rows && srcMat.type() == weights.type() && weights.type() == dstMat.type() && srcMat.type() == CV_32F && (biasMat.empty() || (biasMat.type() == srcMat.type() && biasMat.isContinuous() && (int)biasMat.total() == dstMat.cols)) in function 'cv::dnn::FullyConnectedLayerImpl::FullyConnected::run'

    files are in dd folder in streaming asset,...

    and chen i try another onnx on th github of onnx,
    unity crash!

    I think I must do something wrong or put files that are probably not suitable?

    i would like put this files
    https://github.com/onnx/models/tree/master/vision/body_analysis/age_gender

    how i cant do that with your asset?
    thanks
     
  10. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Hi, macfry.

    Not all inference models can be loaded by the OpenCV Dnn module. If layers included in the model do not correspond, an error or crash will occur.

    Fortunately, the age_gender model you wanted could be inferred with code like this:

    Code (CSharp):
    1. using OpenCVForUnity.CoreModule;
    2. using OpenCVForUnity.DnnModule;
    3. using OpenCVForUnity.ImgcodecsModule;
    4. using OpenCVForUnity.UnityUtils;
    5. using System.Collections.Generic;
    6. using UnityEngine;
    7. using Rect = OpenCVForUnity.CoreModule.Rect;
    8.  
    9. /// <summary>
    10. /// AgeGenderTest
    11. ///
    12. /// Referring to https://github.com/onnx/models/blob/master/vision/body_analysis/age_gender/levi_googlenet.py.
    13. ///
    14. /// Download the following files and move to the "StreamingAssets/dnn/age_gender" folder.
    15. /// https://github.com/onnx/models/raw/master/vision/body_analysis/age_gender/dependencies/kid.jpg
    16. /// https://github.com/onnx/models/raw/master/vision/body_analysis/age_gender/models/age_googlenet.onnx
    17. /// https://github.com/onnx/models/raw/master/vision/body_analysis/age_gender/models/gender_googlenet.onnx
    18. /// </summary>
    19. public class AgeGenderTest : MonoBehaviour
    20. {
    21.  
    22.     List<string> genderList = new List<string> { "Male", "Female" };
    23.     List<string> ageList = new List<string> { "(0-2)", "(4-6)", "(8-12)", "(15-20)", "(25-32)", "(38-43)", "(48-53)", "(60-100)" };
    24.  
    25.     // Use this for initialization
    26.     void Start()
    27.     {
    28.  
    29.         //if true, The error log of the Native side OpenCV will be displayed on the Unity Editor Console.
    30.         Utils.setDebugMode(true);
    31.  
    32.  
    33.         string image_filepath = Utils.getFilePath("dnn/age_gender/" + "kid.jpg");
    34.         string age_model_filepath = Utils.getFilePath("dnn/age_gender/" + "age_googlenet.onnx");
    35.         string gender_model_filepath = Utils.getFilePath("dnn/age_gender/" + "gender_googlenet.onnx");
    36.  
    37.         Mat orig_img = Imgcodecs.imread(image_filepath);
    38.         Mat img = new Mat(orig_img, new Rect(472, 102, 211, 270)); // crop image. (face region)
    39.  
    40.         Net age_net = Dnn.readNetFromONNX(age_model_filepath);
    41.         Net gender_net = Dnn.readNetFromONNX(gender_model_filepath);
    42.  
    43.        
    44.         Mat input = Dnn.blobFromImage(img, 1.0, new Size(224, 224), new Scalar(104, 117, 123), true, false, CvType.CV_32F);
    45.  
    46.  
    47.         // gender classification
    48.         gender_net.setInput(input);
    49.         Mat genders = gender_net.forward();
    50.         Core.MinMaxLocResult gender_max = Core.minMaxLoc(genders);
    51.         int gender_idx = (int)gender_max.maxLoc.x;
    52.  
    53.         Debug.Log("Gender: " + genderList[gender_idx]);
    54.  
    55.  
    56.         // age classification
    57.         age_net.setInput(input);
    58.         Mat ages = age_net.forward();
    59.         Core.MinMaxLocResult age_max = Core.minMaxLoc(ages);
    60.         int age_idx = (int)age_max.maxLoc.x;
    61.  
    62.         Debug.Log("Age: " + ageList[age_idx]);
    63.  
    64.  
    65.         Utils.setDebugMode(false);
    66.     }
    67. }
     
  11. macfry

    macfry

    Joined:
    Sep 17, 2018
    Posts:
    5
    I will try!!! thanks a lot!
     
  12. macfry

    macfry

    Joined:
    Sep 17, 2018
    Posts:
    5
    it's work fine on a picture but i would like try this with webcamtexture...
     
  13. CatrinMariachi

    CatrinMariachi

    Joined:
    Nov 24, 2015
    Posts:
    20
    CV vtuber example, it's working fine except the video capture example; I can't get it to work. In fact, any of the video capture examples (OpenCV or DlibFaceLandmarkDetector video capture examples).


    ArgumentException: imgMat.isContinuous() must be true.
    CVVTuber.OpenCVForUnityUtils.SetImage (DlibFaceLandmarkDetector.FaceLandmarkDetector faceLandmarkDetector, OpenCVForUnity.CoreModule.Mat imgMat) (at Assets/CVVTuberExample/CVVTuber/Scripts/Utils/OpenCVForUnityUtils.cs:32)
    CVVTuber.DlibFaceLandmarkGetter.UpdateValue () (at Assets/CVVTuberExample/CVVTuber/Scripts/DlibFaceLandmarkGetter.cs:216)
    CVVTuber.CVVTuberControllManager.Update () (at Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberControllManager.cs:52)
     
  14. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Could you tell me the environment you tested?
    OpenCVForUnity version :
    DlibFaceLandmarkDetector version :
    CVVTuberExample version :
    Unity Version :
    Editor Platform :
     
  15. CatrinMariachi

    CatrinMariachi

    Joined:
    Nov 24, 2015
    Posts:
    20
    OpenCVForUnity: 2.4.2
    DlibFaceLandmarkDetector version :1.3.2
    CVVTuberExample version :1.0.6
    Unity Version : 2019.4.18f1
    Editor Platform : windows 7 sp1.
     
  16. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    The system requirement for OpenCVForUnity is Windows 8 or later. Does the error occur in Windows 8 or later?
     
  17. skapp

    skapp

    Joined:
    Nov 29, 2017
    Posts:
    1
    I seem to have "found" a bug in the plugin:
    Defining and initializing a MatOfDouble inside a class works if the Unity Editor is already running but if I exit Unity it crashes on startup.

    The line causing the crash is (dummy code):
    Code (CSharp):
    1. public class abc : MonoBehaviour
    2. {
    3.      private MatOfDouble mat = new MatOfDouble(new double[] { 0, 0, 0, 0 });
    4. }
    This code works without issues if I add it in the script while Unity is running but if I exit the Editor and then start it again, with no changes in the previously working script, it crashes on startup.

    If I initialize the variable in e.g. the Awake function I can close Unity and open it again without issues (dummy code):
    Code (CSharp):
    1. public class abc : MonoBehaviour
    2. {
    3.      private MatOfDouble mat;
    4.  
    5.      void Awake() {
    6.           mat = new MatOfDouble(new double[] { 0, 0, 0, 0 });
    7.      }
    8. }

    Looking into the Editor.log created by Unity during the crash this is the core error message:
    After a short Google search a similar issue seemed to exist in a different project: https://www.noesisengine.com/bugs/view.php?id=1538
    As their workaround is basically the same that I came up with and they diagnosed an issue in their project I think this also is a bug in the plugin and not in my code or Unity itself.

    I was able to reproduce the issue in Unity 2019.4.17f1 and 2019.4.18f1 with Windows 10 and plugin version 2.4.2.
     
  18. valdeezzee

    valdeezzee

    Joined:
    Jan 21, 2014
    Posts:
    7
    Hi,
    I am working with the Yolo Object Detection example. I am trying to figure out how to overlay a ui element or gameobject on the detected object bounding box. I've searched and can't seem to find a solution. I know this here creates the bounding box
    Code (CSharp):
    1. Imgproc.rectangle(frame, new Point(left, top), new Point(right, bottom), new Scalar(0, 255, 0, 255), 2);
    Is there a way to grab those point and convert them into a Vector3?


    I attached an image with the desired result.
     

    Attached Files:

  19. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Thank you very much for reporting.
    The cause of this bug is currently under investigation.
     
  20. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    I think the attached file will help you.
    This example shows how to overlay a 3D object on the center of a detected face.
    DetectFace2DTo3DExample2.4.2.PNG
     

    Attached Files:

    valdeezzee likes this.
  21. valdeezzee

    valdeezzee

    Joined:
    Jan 21, 2014
    Posts:
    7
    Thank you!! That worked exactly how I needed it to.
     
  22. y-masutani

    y-masutani

    Joined:
    Aug 30, 2020
    Posts:
    3
    Hi,
    Can I use GStreamer for backend of VideoCapture class on Windows?
    I installed GStreamer 1.18.3. But the following code does not work well.
    Code (CSharp):
    1. VideoCapture capture;
    2. capture.open("videotestsrc ! videoconvert ! appsink");
     
  23. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    In order to use Gstreamer, you need to enable Gstreamer and recompile OpenCV.
    I've custom built a gstreamer-enabled OpenCV before and combined it with OpenCVForUnity.
    For more details, see the section on “How to use OpenCV Dynamic Link Library with customized build settings” in ReadMe.pdf.

    I have successfully connected the rtsp protocol by following the steps below.
    1. Follow the instructions on the following page to build OpenCV dynamic library.
    https://funvision.blogspot.com/2020/03/compile-opencv-4-for-visual-studio-2019.html
    OpenCV4.5.0
    https://github.com/opencv/opencv/tree/78476a0fe25b761dfda813f9ba030e5d7f1aa82f
    https://github.com/opencv/opencv_contrib/tree/37315babf9984a5b6aa981644a20dd8df1a5ff02
    cmake.PNG

    2. Copy “OpenCVForUnity\Extra\dll_version\Windows\” to
    “OpenCVForUnity\Plugins\Windows\”.
    3. Copy the built OpenCV dynamic library to the "OpenCVForUnity\Plugins\Windows\" folder.
    dll_importsettings.PNG
    4. Change to the attached VideoCaptureExample.cs.

    capture.open("videotestsrc ! videoconvert ! appsink", Videoio.CAP_GSTREAMER);
    videotestsrc ! videoconvert ! appsink.PNG
    capture.open("rtspsrc location=rtsp://91.191.213.49:554/live_mpeg4.sdp latency=0 dulation=-1 ! decodebin ! videoconvert ! appsink", Videoio.CAP_GSTREAMER);
    rtspsrc.PNG
     

    Attached Files:

  24. InformaticaIQx

    InformaticaIQx

    Joined:
    Jan 7, 2020
    Posts:
    6
    Hi, i'm testing the aruco example scenes but i am having a problem. When i use the dummy camera matrix everything goes well, but when i try to calibrate it with the calibration example scene, and use the new camera matrix and distortion coefficients in the webcam aruco example scene, it draws well the corners and pose (so i guess i did a good calibration), but something is off, since it offsets the ar cube, as you can see in the following images:
    upload_2021-1-26_12-28-1.png upload_2021-1-26_12-28-7.png

    I tried calibrating multiples times and i always get the same result. Does someone know what could be happening?
    I'm just using the example scenes without any modification and the last OpenCVForUnity with a logitech c920 hd pro, which has very little distortion. I also noted that this horizontal error offset of the cube position is proportionally similar to the difference between the default cx component of the camera matrix and the calibrated cx component of the matrix.
     
    Last edited: Jan 27, 2021
  25. arklay_corp

    arklay_corp

    Joined:
    Apr 23, 2014
    Posts:
    242
    Hi,

    I'm working in a project: I have a picture, inside this picture I know N coplanar points (I have the world 3d coordinates and the coordinates in the image). I want to find out the camera position of the camera for the image. I managed to get it to work for python, but in your plugin I'm getting wrong output values for the same input data:

    Python code:
    Code (CSharp):
    1.  
    2. print(f'FIELD objectPoints {world_points}\nimagePoints {screen_points}\ncamMatrix {camera_matrix}\ndistCoeffs {dist_coeffs}');
    3.             _ret, rvec, tvec = cv.solvePnP(world_points, screen_points, camera_matrix, dist_coeffs, cv.SOLVEPNP_IPPE)
    4.             print(f'FIELD rvec {rvec}\ntvec {tvec}');
    5.  
    C# code:
    Code (CSharp):
    1.            
    2. Debug.Log($"FIELD objectPoints {objectPoints.dump()}\nimagePoints {imagePoints.dump()}\ncamMatrix {camMatrix.dump()}\ndistCoeffs {distCoeffs.dump()}");
    3.             Calib3d.solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec, true, Calib3d.SOLVEPNP_IPPE);
    4.             Debug.Log($"FIELD rvec {rvec.dump()}\ntvec {tvec.dump()}");
    5.  
    Python output:
    Code (CSharp):
    1.  
    2. FIELD objectPoints [[ 52.5    0.    34.  ]
    3. [ 52.5    0.    -3.66]
    4. [ 36.     0.   -20.16]
    5. [ 41.5    0.     0.  ]]
    6. imagePoints [[ 471.35842368  338.10150168]
    7. [1740.883776    567.4959036 ]
    8. [1561.767552    866.02291884]
    9. [ 936.43209408  581.065272  ]]
    10. camMatrix [[6.28360766e+03 0.00000000e+00 9.60000000e+02]
    11. [0.00000000e+00 6.28360766e+03 5.40000000e+02]
    12. [0.00000000e+00 0.00000000e+00 1.00000000e+00]]
    13. distCoeffs [[0.]
    14. [0.]
    15. [0.]
    16. [0.]]
    17. FIELD rvec [[ 0.13082996]
    18. [-0.57601962]
    19. [-0.02956267]]
    20. tvec [[-34.96040194]
    21. [  3.35909129]
    22. [ 62.97022695]]
    23.  
    C# output:

    Code (CSharp):
    1.  
    2. FIELD objectPoints [52.5, 0, 34;
    3. 52.5, 0, -3.6600001;
    4. 36, 0, -20.16;
    5. 41.5, 0, 0]
    6. imagePoints [471.35843, 338.1015;
    7. 1740.8838, 567.49591;
    8. 1561.7676, 866.02295;
    9. 936.43207, 581.06531]
    10. camMatrix [6283.60791015625, 0, 960;
    11. 0, 6283.60791015625, 540;
    12. 0, 0, 1]
    13. distCoeffs [0;
    14. 0;
    15. 0;
    16. 0]
    17. FIELD rvec [0.1538111422233873;
    18. -0.6324571644188874;
    19. -0.02627024069205628]
    20. tvec [-32.95994179269246;
    21. 3.826083621349714;
    22. 72.16430511224465]
    23.  
    Any idea why?
     
  26. y-masutani

    y-masutani

    Joined:
    Aug 30, 2020
    Posts:
    3
    Thank you very much for the detailed instructions.

    I followed the instructions and was able to display video in case of videotestsrc. However, in the case of rtspsrc, it does not work well. Only the first retrieve() works and the image is displayed, but after that retrieve() does not work at all.

    I try using the same GStreamer command sequence for my C++ program using the same DLLs on the same PC, and there is no problem, the streaming video is displayed continuously.

    What should I do?
     
  27. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    There are three types of camera parameters that can be obtained by OpenCV calibration: internal parameters (camera matrix), distortion parameters, and external parameters.
    To get a perfect fit between the AR object and the camera image, you will probably need to set distortion parameters for the Unity Camera. You will probably need to use a shader for this.
     
  28. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Thank you very much for reporting.

    Is OpenCV version the same in Python and C# Code?
    OpenCVForUnity uses OpenCV 4.5.0.
    https://github.com/opencv/opencv/tree/78476a0fe25b761dfda813f9ba030e5d7f1aa82f
    https://github.com/opencv/opencv_contrib/tree/37315babf9984a5b6aa981644a20dd8df1a5ff02
     
  29. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    The previous code was wrong. Could you please change it to the following?

    Code (CSharp):
    1. capture.open("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", Videoio.CAP_GSTREAMER);
    Code (CSharp):
    1.             capture.grab();
    2.             if (capture.retrieve(rgbMat))
    3.             {
    bunney.PNG
     

    Attached Files:

  30. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564

    This is the result of a similar test code running on C++.

    c++ code:

    Code (CSharp):
    1.  
    2. #include <opencv2/opencv.hpp>
    3. #include <opencv2/highgui/highgui.hpp>
    4. #include <opencv2/imgproc.hpp>
    5. #include <opencv2/calib3d.hpp>
    6.  
    7. using namespace std;
    8. using namespace cv;
    9.  
    10. int main(void)
    11. {
    12.     vector<Point3f> objectPoints;
    13.     objectPoints.push_back(Point3d(52.5, 0, 34));
    14.     objectPoints.push_back(Point3d(52.5, 0, -3.6600001));
    15.     objectPoints.push_back(Point3d(36, 0, -20.16));
    16.     objectPoints.push_back(Point3d(41.5, 0, 0));
    17.     vector<Point2f> imagePoints;
    18.     imagePoints.push_back(Point2d(471.35843, 338.1015));
    19.     imagePoints.push_back(Point2d(1740.8838, 567.49591));
    20.     imagePoints.push_back(Point2d(1561.7676, 866.02295));
    21.     imagePoints.push_back(Point2d(936.43207, 581.06531));
    22.     Mat camMatrix = (cv::Mat_<double>(3, 3) << 6283.60791015625, 0, 960,
    23.         0, 6283.60791015625, 540,
    24.         0, 0, 1);
    25.     Mat distCoeffs = (cv::Mat_<double>(4, 1) << 0, 0, 0, 0);
    26.  
    27.     Mat rvec, tvec;
    28.     solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec, true, SOLVEPNP_IPPE);
    29.  
    30.     cout << "objectPoints : " << objectPoints << endl;
    31.     cout << "imagePoints : " << imagePoints << endl;
    32.     cout << "camMatrix : " << camMatrix << endl;
    33.     cout << "distCoeffs : " << distCoeffs << endl;
    34.     cout << "rvec : " << rvec << endl;
    35.     cout << "tvec : " << tvec << endl;
    36.  
    37.     cv::waitKey(0);
    38. }
    39.  
    c++ output:

    Code (CSharp):
    1. objectPoints: [52.5, 0, 34;
    2.     52.5, 0, -3.6600001;
    3.     36, 0, -20.16;
    4.     41.5, 0, 0]
    5.     imagePoints : [471.35843, 338.1015;
    6.     1740.8838, 567.49591;
    7.     1561.7676, 866.02295;
    8.     936.43207, 581.06531]
    9.         camMatrix : [6283.60791015625, 0, 960;
    10.     0, 6283.60791015625, 540;
    11.     0, 0, 1]
    12.         distCoeffs : [0;
    13.     0;
    14.     0;
    15.     0]
    16.         rvec : [0.1538111422233873;
    17.     -0.6324571644188874;
    18.     -0.02627024069205628]
    19.         tvec : [-32.95994179269246;
    20.     3.826083621349714;
    21.     72.16430511224465]
    I think the difference between C++ / C# (OpenCVForUnity) and python results is a python binding issue.
     
    Last edited: Jan 30, 2021
  31. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    97
    @EnoxSoftware I have an interesting issue. I am using the face mask example with open cv and dlib.

    Thee is a crash whenever this f(x) is called. Utils.texture2DToMat()

    The log stack trace leads back to here. OpenCVForUnity_ByteArrayToMatData()


    Unity 2018.3.6f1
    Open CV version 2.4.2 (according to the readme.pdf)
    Building for UWP.

    Has you or anyone encountered this issue before? How can I fix this? Thanks in advance!
     

    Attached Files:

  32. EddieOffermann

    EddieOffermann

    Joined:
    Sep 13, 2015
    Posts:
    13
    Having issues with Cloud Build on a project using this library. "opencv2 not found in dylib search path"

    Platform: iOS
    OCV4U Version: 2.4.2
    Unity Version: 2019.4.19f1
    Unity Version (Cloud Build): 2019.4.18f1 (Latest 2019.4 available in Cloud Build)

    I'm able to build the project without issue for Android. Builds for Windows fine as well.

    I don't generally build iOS apps locally - I have an older MacMini that I use for Keychain to set up app signing, but it's not suitable for building on any more - so I have no idea if this problem occurs on a local XCode build.


    The key issue comes up here:

    36112: Search Path: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin, /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos, /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/lib, /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/System/Library/Frameworks
    36113: opencv2 not found in dylib search path
    36114: Stderr:
    36115: >
    36116: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:373:in `run'
    36117: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:2808:in `block in CompileOrStripBitcodeInBundle'
    36118: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:2747:in `each'
    36119: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:2747:in `CompileOrStripBitcodeInBundle'
    36120: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:3016:in `block in ProcessIPA'
    36121: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:2978:in `each'
    36122: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:2978:in `ProcessIPA'
    36123: /APPLICATION_PATH/Xcode12_2_0.app/Contents/Developer/usr/bin/ipatool:3928:in `<main>'}
    36124: ** EXPORT FAILED **
     
  33. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    It seems to "import settings" are not correct.
    Please make sure it is set as follows.
    MenuItem.png
    スクリーンショット 2015-07-25 22.29.58.png
    スクリーンショット 2015-07-25 22.30.11.png
     
  34. y-masutani

    y-masutani

    Joined:
    Aug 30, 2020
    Posts:
    3
    Sorry for the late response.

    I put
    Debug.Log(capture.getBackendName()); 
    after
    capture.open(...); 
    in your code.
    Then I tried several cases:
    • capture.open("videotestsrc ! videoconvert ! appsink");
      • Test pattern is displayed and the console says GSTREAMER.
    • capture.open("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
      • An animated movie is displayed and the console says FFMPEG.
    • capture.open("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", Videoio.CAP_GSTREAMER);
      • Unity Editor hangs.
    • capture.open("rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! decodebin ! videoconvert ! appsink");
      • Unity Editor hangs.
    I still can't successfully capture RTSP streaming video using GStreamer backend.
     
  35. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Currently, this stream does not seem to be working.
    Even if I run gstreamer directly at the command prompt, receiving the stream fails.
    Code (CSharp):
    1. gst-launch-1.0 rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! decodebin !  autovideosink
     
  36. drralane

    drralane

    Joined:
    Oct 31, 2020
    Posts:
    2
    Hi everyone.

    Apologies if this has been asked and please point me in a direction if needed but I've searched the forum and have not resolved my question.

    I am new to the product but from what I have played with so far it is fantastic. I am in need of some guidance on feasibility to do an activity. I have played with the detection side for detecting circles etc, but is it possible to match against non standard geometric shapes. I don't want to go down an incorrect rabbit warren. I am after a pointer to the docs or similar if it can be done but can post code later if needed. I have uploaded two images for an indication of what kind of shapes they are.

    Is it possible to pattern match these against a database and how? Also is it possible to outline so I can determine the area (with reference sizing information) so I can provide size discriminators as well as shape?

    Any assistance that can be provided is welcomed. Or if you need further info I can provide.

    Love the product.

    Cheers.
     

    Attached Files:

  37. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
    Hello there again, I wanted to ask something is that are there any asset that can be used to only detect colour within a specific place and is it able to be built to the front-camera (selfie camera) on android as well? if so please let me know :D
     
  38. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Perhaps MatchShapesExample will be helpful.
    https://github.com/EnoxSoftware/Ope...proc/MatchShapesExample/MatchShapesExample.cs

    https://docs.opencv.org/4.5.0/d5/d45/tutorial_py_contours_more_functions.html
    https://learnopencv.com/shape-matching-using-hu-moments-c-python/
     
    drralane likes this.
  39. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    For color detection, you may find the MultiObjectTrackingBasedOnColorExample useful.
    https://github.com/EnoxSoftware/Ope...ple/MultiObjectTrackingBasedOnColorExample.cs
     
  40. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
  41. peeth

    peeth

    Joined:
    Apr 3, 2019
    Posts:
    2
    Hi enox software,

    I have purchased both the latest versions of opencvforunty and dliblandmarkdetector packages last month. I am happy with what I got. I have a question regarding the AR Head Example that had been done under the landmark detection examples. I am trying to see how the AR head can be replaced with a Texture 2D image. I also came across a similar question posted on this thread earlier where you had asked them to download the ARHeadTexture2D example from the drop box and try. I have done that but the moment I import the library into Unity 2020, it gives errors in the editor. Can you kindly advice.

    Thanks
     
  42. peeth

    peeth

    Joined:
    Apr 3, 2019
    Posts:
    2
    Do I have to buy that separately and how ?
     
  43. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
    oh yes... thanks for the reply, I appreciate it. Do you know if I can use both MultiObjectTrackingBasedOnColorExample and WebCamTextureFaceTrackerExample in the same scene and same quad running? I am having a very hard time with this. let me know, please. thankyou
     
  44. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    This package is compatible with newer versions.
    ARHeadTexture2DExample_OpenCV2.4.3_Dlib1.3.2.unitypackage
    ARFaceTextrue2DExample.PNG
     

    Attached Files:

  45. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
    can I get a reply on this one as I needed it fast? thanks in advance though
     
  46. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    It is possible to combine the two examples. However, I do not have such an example.
     
  47. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
    i see, do i have to change the script drastically?
     
  48. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9
    i keep on getting this error

    Code (CSharp):
    1. Object reference not set to an instance of an object
    2. OpenCVForUnityExample.MultiObjectTrackingBasedOnColorExample.OnWebCamTextureToMatHelperInitialized
    any suggestion?
     
  49. EnoxSoftware

    EnoxSoftware

    Joined:
    Oct 29, 2014
    Posts:
    1,564
    Could you send me the code you've tested?
    https://enoxsoftware.com/opencvforunity/contact/technical-inquiry/
     
  50. edberthans

    edberthans

    Joined:
    Jan 26, 2021
    Posts:
    9