コード例 #1
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.BarcodeDetector))
            {
                LogError("owner is not initialized. Add Action \"newBarcodeDetector\".");
                return;
            }
            OpenCVForUnity.BarcodeModule.BarcodeDetector wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.BarcodeDetector, OpenCVForUnity.BarcodeModule.BarcodeDetector>(owner);

            if (!(img.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("img is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_img = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(img);

            if (!(points.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("points is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_points = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(points);

            storeResult.Value = wrapped_owner.detect(wrapped_img, wrapped_points);

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
コード例 #2
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.BarcodeDetector))
            {
                LogError("owner is not initialized. Add Action \"newBarcodeDetector\".");
                return;
            }
            OpenCVForUnity.BarcodeModule.BarcodeDetector wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.BarcodeDetector, OpenCVForUnity.BarcodeModule.BarcodeDetector>(owner);

            if (!(img.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("img is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_img = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(img);

            string[]      string_decoded_info  = decoded_info.stringValues;
            List <string> wrapped_decoded_info = new List <string>(string_decoded_info);

            int[]      int_decoded_type     = decoded_type.intValues;
            List <int> wrapped_decoded_type = new List <int>(int_decoded_type);

            if (!(points.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("points is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_points = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(points);

            storeResult.Value = wrapped_owner.detectAndDecode(wrapped_img, wrapped_decoded_info, wrapped_decoded_type, wrapped_points);

            for (int i = 0; i < wrapped_decoded_info.Count; i++)
            {
                decoded_info.Set(i, (string)wrapped_decoded_info[i]);
            }
            decoded_info.SaveChanges();

            for (int i = 0; i < wrapped_decoded_type.Count; i++)
            {
                decoded_type.Set(i, (int)wrapped_decoded_type[i]);
            }
            decoded_type.SaveChanges();

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
コード例 #3
0
 public BarcodeDetector(OpenCVForUnity.BarcodeModule.BarcodeDetector nativeObj) : base(nativeObj)
 {
 }