void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.WeChatQRCode))
            {
                LogError("owner is not initialized. Add Action \"newWeChatQRCode\".");
                return;
            }
            OpenCVForUnity.Wechat_qrcodeModule.WeChatQRCode wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.WeChatQRCode, OpenCVForUnity.Wechat_qrcodeModule.WeChatQRCode>(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);

            List <string> wrapped_storeResult = wrapped_owner.detectAndDecode(wrapped_img);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != wrapped_storeResult.Count)
                {
                    storeResult.Resize(wrapped_storeResult.Count);
                }
                for (int i = 0; i < wrapped_storeResult.Count; i++)
                {
                    storeResult.Set(i, (string)wrapped_storeResult[i]);
                }
                storeResult.SaveChanges();
            }
        }
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.TextRecognitionModel))
            {
                LogError("owner is not initialized. Add Action \"newTextRecognitionModel\".");
                return;
            }
            OpenCVForUnity.DnnModule.TextRecognitionModel wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.TextRecognitionModel, OpenCVForUnity.DnnModule.TextRecognitionModel>(owner);

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

            List <OpenCVForUnity.CoreModule.Mat> wrapped_roiRects = new List <OpenCVForUnity.CoreModule.Mat>();

            OpenCVForUnityPlayMakerActionsUtils.ConvertFsmArrayToList <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(roiRects, wrapped_roiRects);

            string[]      string_results  = results.stringValues;
            List <string> wrapped_results = new List <string>(string_results);

            wrapped_owner.recognize(wrapped_frame, wrapped_roiRects, wrapped_results);

            OpenCVForUnityPlayMakerActionsUtils.ConvertListToFsmArray <OpenCVForUnity.CoreModule.Mat, OpenCVForUnityPlayMakerActions.Mat>(wrapped_roiRects, roiRects);

            for (int i = 0; i < wrapped_results.Count; i++)
            {
                results.Set(i, (string)wrapped_results[i]);
            }
            results.SaveChanges();
        }
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Net))
            {
                LogError("owner is not initialized. Add Action \"newNet\".");
                return;
            }
            OpenCVForUnity.DnnModule.Net wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Net, OpenCVForUnity.DnnModule.Net>(owner);

            List <OpenCVForUnity.CoreModule.Mat> wrapped_outputBlobs = new List <OpenCVForUnity.CoreModule.Mat>();

            OpenCVForUnityPlayMakerActionsUtils.ConvertFsmArrayToList <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(outputBlobs, wrapped_outputBlobs);

            string[]      string_outBlobNames  = outBlobNames.stringValues;
            List <string> wrapped_outBlobNames = new List <string>(string_outBlobNames);

            wrapped_owner.forward(wrapped_outputBlobs, wrapped_outBlobNames);

            OpenCVForUnityPlayMakerActionsUtils.ConvertListToFsmArray <OpenCVForUnity.CoreModule.Mat, OpenCVForUnityPlayMakerActions.Mat>(wrapped_outputBlobs, outputBlobs);

            for (int i = 0; i < wrapped_outBlobNames.Count; i++)
            {
                outBlobNames.Set(i, (string)wrapped_outBlobNames[i]);
            }
            outBlobNames.SaveChanges();
        }
Ejemplo n.º 4
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.MatOfByte))
            {
                LogError("owner is not initialized. Add Action \"newMatOfByte\".");
                return;
            }
            OpenCVForUnity.CoreModule.MatOfByte wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.MatOfByte, OpenCVForUnity.CoreModule.MatOfByte>(owner);

            int[]  int_lb    = lb.intValues;
            byte[] casted_lb = new byte[int_lb.Length];
            for (int i = 0; i < casted_lb.Length; i++)
            {
                casted_lb[i] = (byte)int_lb[i];
            }
            List <byte> wrapped_lb = new List <byte>(casted_lb);

            wrapped_owner.fromList(wrapped_lb);

            for (int i = 0; i < wrapped_lb.Count; i++)
            {
                lb.Set(i, (int)wrapped_lb[i]);
            }
            lb.SaveChanges();
        }
        void DoProcess()
        {
            int[] int_sizes    = sizes.intValues;
            int[] casted_sizes = new int[int_sizes.Length];
            for (int i = 0; i < casted_sizes.Length; i++)
            {
                casted_sizes[i] = (int)int_sizes[i];
            }

            if (!(s.Value is OpenCVForUnityPlayMakerActions.Scalar))
            {
                LogError("s is not initialized. Add Action \"newScalar\".");
                return;
            }
            OpenCVForUnity.CoreModule.Scalar wrapped_s = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Scalar, OpenCVForUnity.CoreModule.Scalar>(s);

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Mat();
            }
            ((OpenCVForUnityPlayMakerActions.Mat)storeResult.Value).wrappedObject = new OpenCVForUnity.CoreModule.Mat(casted_sizes, type.Value, wrapped_s);

            for (int i = 0; i < casted_sizes.Length; i++)
            {
                sizes.Set(i, (int)casted_sizes[i]);
            }
            sizes.SaveChanges();
        }
Ejemplo n.º 6
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.QRCodeDetector))
            {
                LogError("owner is not initialized. Add Action \"newQRCodeDetector\".");
                return;
            }
            OpenCVForUnity.ObjdetectModule.QRCodeDetector wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.QRCodeDetector, OpenCVForUnity.ObjdetectModule.QRCodeDetector>(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);

            storeResult.Value = wrapped_owner.detectAndDecodeMulti(wrapped_img, wrapped_decoded_info);

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

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
Ejemplo n.º 7
0
        void DoProcess()
        {
            if (!(src.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("src is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_src = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(src);

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

            float[]  float_scale  = scale.floatValues;
            double[] casted_scale = new double[float_scale.Length];
            float_scale.CopyTo(casted_scale, 0);

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Mat();
            }
            ((OpenCVForUnityPlayMakerActions.Mat)storeResult.Value).wrappedObject = OpenCVForUnity.Calib3dModule.Calib3d.estimateAffine3D(wrapped_src, wrapped_dst, casted_scale);

            for (int i = 0; i < casted_scale.Length; i++)
            {
                scale.Set(i, (float)casted_scale[i]);
            }
            scale.SaveChanges();
        }
Ejemplo n.º 8
0
        void DoProcess()
        {
            if (!(owner.Value is DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector))
            {
                LogError("owner is not initialized. Add Action \"newFaceLandmarkDetector\".");
                return;
            }
            DlibFaceLandmarkDetector.FaceLandmarkDetector wrapped_owner = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector, DlibFaceLandmarkDetector.FaceLandmarkDetector> (owner);



            double[] casted_storeResult = wrapped_owner.DetectArray((float)adjust_threshold.Value);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != casted_storeResult.Length)
                {
                    storeResult.Resize(casted_storeResult.Length);
                }
                for (int i = 0; i < casted_storeResult.Length; i++)
                {
                    storeResult.Set(i, (float)casted_storeResult[i]);
                }
                storeResult.SaveChanges();
            }
        }
Ejemplo n.º 9
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("owner is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(owner);

            int[] int_newshape    = newshape.intValues;
            int[] casted_newshape = new int[int_newshape.Length];
            for (int i = 0; i < casted_newshape.Length; i++)
            {
                casted_newshape[i] = (int)int_newshape[i];
            }

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Mat();
            }
            ((OpenCVForUnityPlayMakerActions.Mat)storeResult.Value).wrappedObject = wrapped_owner.reshape(cn.Value, casted_newshape);

            for (int i = 0; i < casted_newshape.Length; i++)
            {
                newshape.Set(i, (int)casted_newshape[i]);
            }
            newshape.SaveChanges();
        }
        void DoProcess()
        {
            int[] int_version_ABI    = version_ABI.intValues;
            int[] casted_version_ABI = new int[int_version_ABI.Length];
            for (int i = 0; i < casted_version_ABI.Length; i++)
            {
                casted_version_ABI[i] = (int)int_version_ABI[i];
            }

            int[] int_version_API    = version_API.intValues;
            int[] casted_version_API = new int[int_version_API.Length];
            for (int i = 0; i < casted_version_API.Length; i++)
            {
                casted_version_API[i] = (int)int_version_API[i];
            }

            storeResult.Value = OpenCVForUnity.VideoioModule.Videoio.getStreamBackendPluginVersion(api.Value, casted_version_ABI, casted_version_API);

            for (int i = 0; i < casted_version_ABI.Length; i++)
            {
                version_ABI.Set(i, (int)casted_version_ABI[i]);
            }
            version_ABI.SaveChanges();

            for (int i = 0; i < casted_version_API.Length; i++)
            {
                version_API.Set(i, (int)casted_version_API[i]);
            }
            version_API.SaveChanges();
        }
Ejemplo n.º 11
0
        void DoProcess()
        {
            if (!(owner.Value is DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector))
            {
                LogError("owner is not initialized. Add Action \"newFaceLandmarkDetector\".");
                return;
            }
            DlibFaceLandmarkDetector.FaceLandmarkDetector wrapped_owner = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector, DlibFaceLandmarkDetector.FaceLandmarkDetector> (owner);

            if (!(adjust_threshold.Value is DlibFaceLandmarkDetectorPlayMakerActions.Double))
            {
                LogError("adjust_threshold is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_adjust_threshold = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.Double, System.Double> (adjust_threshold);


            List <UnityEngine.Rect> wrapped_storeResult = wrapped_owner.Detect(wrapped_adjust_threshold);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != wrapped_storeResult.Count)
                {
                    storeResult.Resize(wrapped_storeResult.Count);
                }
                for (int i = 0; i < wrapped_storeResult.Count; i++)
                {
                    storeResult.Set(i, wrapped_storeResult[i]);
                }
            }
        }
Ejemplo n.º 12
0
        void DoProcess()
        {
            if (!(fontScale.Value is OpenCVForUnityPlayMakerActions.Double))
            {
                LogError("fontScale is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_fontScale = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Double, System.Double>(fontScale);

            int[] int_baseLine    = baseLine.intValues;
            int[] casted_baseLine = new int[int_baseLine.Length];
            for (int i = 0; i < casted_baseLine.Length; i++)
            {
                casted_baseLine[i] = (int)int_baseLine[i];
            }

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Size))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Size();
            }
            ((OpenCVForUnityPlayMakerActions.Size)storeResult.Value).wrappedObject = OpenCVForUnity.ImgprocModule.Imgproc.getTextSize(text.Value, fontFace.Value, wrapped_fontScale, thickness.Value, casted_baseLine);

            for (int i = 0; i < casted_baseLine.Length; i++)
            {
                baseLine.Set(i, (int)casted_baseLine[i]);
            }
            baseLine.SaveChanges();
        }
Ejemplo n.º 13
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("owner is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(owner);

            int[] int_idx    = idx.intValues;
            int[] casted_idx = new int[int_idx.Length];
            for (int i = 0; i < casted_idx.Length; i++)
            {
                casted_idx[i] = (int)int_idx[i];
            }

            if (!(data.Value is OpenCVForUnityPlayMakerActions.ByteArray))
            {
                LogError("data is not initialized. Add Action \"newByteArray\".");
                return;
            }
            System.Byte[] wrapped_data = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ByteArray, System.Byte[]>(data);

            storeResult.Value = wrapped_owner.put(casted_idx, wrapped_data);

            for (int i = 0; i < casted_idx.Length; i++)
            {
                idx.Set(i, (int)casted_idx[i]);
            }
            idx.SaveChanges();
        }
        void DoProcess()
        {
            if (!(points.Value is OpenCVForUnityPlayMakerActions.MatOfPoint2f))
            {
                LogError("points is not initialized. Add Action \"newMatOfPoint2f\".");
                return;
            }
            OpenCVForUnity.CoreModule.MatOfPoint2f wrapped_points = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.MatOfPoint2f, OpenCVForUnity.CoreModule.MatOfPoint2f>(points);

            if (!(center.Value is OpenCVForUnityPlayMakerActions.Point))
            {
                LogError("center is not initialized. Add Action \"newPoint\".");
                return;
            }
            OpenCVForUnity.CoreModule.Point wrapped_center = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Point, OpenCVForUnity.CoreModule.Point>(center);

            float[] float_radius  = radius.floatValues;
            float[] casted_radius = new float[float_radius.Length];
            for (int i = 0; i < casted_radius.Length; i++)
            {
                casted_radius[i] = (float)float_radius[i];
            }

            OpenCVForUnity.ImgprocModule.Imgproc.minEnclosingCircle(wrapped_points, wrapped_center, casted_radius);

            for (int i = 0; i < casted_radius.Length; i++)
            {
                radius.Set(i, (float)casted_radius[i]);
            }
            radius.SaveChanges();
        }
Ejemplo n.º 15
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Subdiv2D))
            {
                LogError("owner is not initialized. Add Action \"newSubdiv2D\".");
                return;
            }
            OpenCVForUnity.ImgprocModule.Subdiv2D wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Subdiv2D, OpenCVForUnity.ImgprocModule.Subdiv2D>(owner);

            int[] int_firstEdge    = firstEdge.intValues;
            int[] casted_firstEdge = new int[int_firstEdge.Length];
            for (int i = 0; i < casted_firstEdge.Length; i++)
            {
                casted_firstEdge[i] = (int)int_firstEdge[i];
            }

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Point))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Point();
            }
            ((OpenCVForUnityPlayMakerActions.Point)storeResult.Value).wrappedObject = wrapped_owner.getVertex(vertex.Value, casted_firstEdge);

            for (int i = 0; i < casted_firstEdge.Length; i++)
            {
                firstEdge.Set(i, (int)casted_firstEdge[i]);
            }
            firstEdge.SaveChanges();
        }
        void DoProcess()
        {
            string[]      string_images  = images.stringValues;
            List <string> wrapped_images = new List <string>(string_images);

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

            if (!(delim.Value is OpenCVForUnityPlayMakerActions.Char))
            {
                LogError("delim is not initialized. Add Action \"newChar\".");
                return;
            }
            System.Char wrapped_delim = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Char, System.Char>(delim);

            storeResult.Value = OpenCVForUnity.FaceModule.Face.loadTrainingData(filename.Value, wrapped_images, wrapped_facePoints, wrapped_delim, offset.Value);

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

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
        void DoProcess()
        {
            string[]      string_filename  = filename.stringValues;
            List <string> wrapped_filename = new List <string>(string_filename);

            List <OpenCVForUnity.CoreModule.MatOfPoint2f> wrapped_trainlandmarks = new List <OpenCVForUnity.CoreModule.MatOfPoint2f>();

            OpenCVForUnityPlayMakerActionsUtils.ConvertFsmArrayToList <OpenCVForUnityPlayMakerActions.MatOfPoint2f, OpenCVForUnity.CoreModule.MatOfPoint2f>(trainlandmarks, wrapped_trainlandmarks);

            string[]      string_trainimages  = trainimages.stringValues;
            List <string> wrapped_trainimages = new List <string>(string_trainimages);

            storeResult.Value = OpenCVForUnity.FaceModule.Face.loadTrainingData(wrapped_filename, wrapped_trainlandmarks, wrapped_trainimages);

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

            OpenCVForUnityPlayMakerActionsUtils.ConvertListToFsmArray <OpenCVForUnity.CoreModule.MatOfPoint2f, OpenCVForUnityPlayMakerActions.MatOfPoint2f>(wrapped_trainlandmarks, trainlandmarks);

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

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("owner is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(owner);

            int[] int_idx    = idx.intValues;
            int[] casted_idx = new int[int_idx.Length];
            for (int i = 0; i < casted_idx.Length; i++)
            {
                casted_idx[i] = (int)int_idx[i];
            }

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.DoubleArray))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.DoubleArray();
            }
            ((OpenCVForUnityPlayMakerActions.DoubleArray)storeResult.Value).wrappedObject = wrapped_owner.get(casted_idx);

            for (int i = 0; i < casted_idx.Length; i++)
            {
                idx.Set(i, (int)casted_idx[i]);
            }
            idx.SaveChanges();
        }
Ejemplo n.º 19
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("owner is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(owner);

            int[] int_idx    = idx.intValues;
            int[] casted_idx = new int[int_idx.Length];
            for (int i = 0; i < casted_idx.Length; i++)
            {
                casted_idx[i] = (int)int_idx[i];
            }

            float[]  float_data  = data.floatValues;
            double[] casted_data = new double[float_data.Length];
            float_data.CopyTo(casted_data, 0);

            storeResult.Value = wrapped_owner.get(casted_idx, casted_data);

            for (int i = 0; i < casted_idx.Length; i++)
            {
                idx.Set(i, (int)casted_idx[i]);
            }
            idx.SaveChanges();

            for (int i = 0; i < casted_data.Length; i++)
            {
                data.Set(i, (float)casted_data[i]);
            }
            data.SaveChanges();
        }
        void DoProcess()
        {
            if (!(owner.Value is DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector))
            {
                LogError("owner is not initialized. Add Action \"newFaceLandmarkDetector\".");
                return;
            }
            DlibFaceLandmarkDetector.FaceLandmarkDetector wrapped_owner = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector, DlibFaceLandmarkDetector.FaceLandmarkDetector> (owner);



            List <UnityEngine.Vector2> wrapped_storeResult = wrapped_owner.DetectLandmark((float)left.Value, (float)right.Value, (float)width.Value, (float)height.Value);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != wrapped_storeResult.Count)
                {
                    storeResult.Resize(wrapped_storeResult.Count);
                }
                for (int i = 0; i < wrapped_storeResult.Count; i++)
                {
                    storeResult.Set(i, wrapped_storeResult[i]);
                }
            }
        }
        void DoProcess()
        {
            if (!(src.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("src is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_src = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(src);

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

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

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

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

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

            double[] casted_storeResult = OpenCVForUnity.Calib3dModule.Calib3d.RQDecomp3x3(wrapped_src, wrapped_mtxR, wrapped_mtxQ, wrapped_Qx, wrapped_Qy, wrapped_Qz);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != casted_storeResult.Length)
                {
                    storeResult.Resize(casted_storeResult.Length);
                }
                for (int i = 0; i < casted_storeResult.Length; i++)
                {
                    storeResult.Set(i, (float)casted_storeResult[i]);
                }
                storeResult.SaveChanges();
            }
        }
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.Dictionary))
            {
                LogError("owner is not initialized. Add Action \"newDictionary\".");
                return;
            }
            OpenCVForUnity.ArucoModule.Dictionary wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Dictionary, OpenCVForUnity.ArucoModule.Dictionary>(owner);

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

            int[] int_idx    = idx.intValues;
            int[] casted_idx = new int[int_idx.Length];
            for (int i = 0; i < casted_idx.Length; i++)
            {
                casted_idx[i] = (int)int_idx[i];
            }

            int[] int_rotation    = rotation.intValues;
            int[] casted_rotation = new int[int_rotation.Length];
            for (int i = 0; i < casted_rotation.Length; i++)
            {
                casted_rotation[i] = (int)int_rotation[i];
            }

            if (!(maxCorrectionRate.Value is OpenCVForUnityPlayMakerActions.Double))
            {
                LogError("maxCorrectionRate is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_maxCorrectionRate = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Double, System.Double>(maxCorrectionRate);

            storeResult.Value = wrapped_owner.identify(wrapped_onlyBits, casted_idx, casted_rotation, wrapped_maxCorrectionRate);

            for (int i = 0; i < casted_idx.Length; i++)
            {
                idx.Set(i, (int)casted_idx[i]);
            }
            idx.SaveChanges();

            for (int i = 0; i < casted_rotation.Length; i++)
            {
                rotation.Set(i, (int)casted_rotation[i]);
            }
            rotation.SaveChanges();

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
        void DoProcess()
        {
            if (!(cameraMatrix.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                LogError("cameraMatrix is not initialized. Add Action \"newMat\".");
                return;
            }
            OpenCVForUnity.CoreModule.Mat wrapped_cameraMatrix = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.Mat, OpenCVForUnity.CoreModule.Mat>(cameraMatrix);

            float[]  float_fovx  = fovx.floatValues;
            double[] casted_fovx = new double[float_fovx.Length];
            float_fovx.CopyTo(casted_fovx, 0);

            float[]  float_fovy  = fovy.floatValues;
            double[] casted_fovy = new double[float_fovy.Length];
            float_fovy.CopyTo(casted_fovy, 0);

            float[]  float_focalLength  = focalLength.floatValues;
            double[] casted_focalLength = new double[float_focalLength.Length];
            float_focalLength.CopyTo(casted_focalLength, 0);

            float[]  float_aspectRatio  = aspectRatio.floatValues;
            double[] casted_aspectRatio = new double[float_aspectRatio.Length];
            float_aspectRatio.CopyTo(casted_aspectRatio, 0);

            OpenCVForUnity.Calib3dModule.Calib3d.calibrationMatrixValues(wrapped_cameraMatrix, new OpenCVForUnity.CoreModule.Size((double)imageSize_width.Value, (double)imageSize_height.Value), (float)apertureWidth.Value, (float)apertureHeight.Value, casted_fovx, casted_fovy, casted_focalLength, new OpenCVForUnity.CoreModule.Point((double)principalPoint_x.Value, (double)principalPoint_y.Value), casted_aspectRatio);

            for (int i = 0; i < casted_fovx.Length; i++)
            {
                fovx.Set(i, (float)casted_fovx[i]);
            }
            fovx.SaveChanges();

            for (int i = 0; i < casted_fovy.Length; i++)
            {
                fovy.Set(i, (float)casted_fovy[i]);
            }
            fovy.SaveChanges();

            for (int i = 0; i < casted_focalLength.Length; i++)
            {
                focalLength.Set(i, (float)casted_focalLength[i]);
            }
            focalLength.SaveChanges();

            for (int i = 0; i < casted_aspectRatio.Length; i++)
            {
                aspectRatio.Set(i, (float)casted_aspectRatio[i]);
            }
            aspectRatio.SaveChanges();
        }
        void DoProcess()
        {
            if (!(owner.Value is DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector))
            {
                LogError("owner is not initialized. Add Action \"newFaceLandmarkDetector\".");
                return;
            }
            DlibFaceLandmarkDetector.FaceLandmarkDetector wrapped_owner = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.FaceLandmarkDetector, DlibFaceLandmarkDetector.FaceLandmarkDetector> (owner);

            if (!(left.Value is DlibFaceLandmarkDetectorPlayMakerActions.Double))
            {
                LogError("left is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_left = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.Double, System.Double> (left);
            if (!(right.Value is DlibFaceLandmarkDetectorPlayMakerActions.Double))
            {
                LogError("right is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_right = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.Double, System.Double> (right);
            if (!(width.Value is DlibFaceLandmarkDetectorPlayMakerActions.Double))
            {
                LogError("width is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_width = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.Double, System.Double> (width);
            if (!(height.Value is DlibFaceLandmarkDetectorPlayMakerActions.Double))
            {
                LogError("height is not initialized. Add Action \"newDouble\".");
                return;
            }
            System.Double wrapped_height = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.Double, System.Double> (height);


            List <UnityEngine.Vector2> wrapped_storeResult = wrapped_owner.DetectLandmark(wrapped_left, wrapped_right, wrapped_width, wrapped_height);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != wrapped_storeResult.Count)
                {
                    storeResult.Resize(wrapped_storeResult.Count);
                }
                for (int i = 0; i < wrapped_storeResult.Count; i++)
                {
                    storeResult.Set(i, wrapped_storeResult[i]);
                }
            }
        }
        void DoProcess()
        {

            string[] string_layersTypes = layersTypes.stringValues;
            List<string> wrapped_layersTypes = new List<string>(string_layersTypes);

            OpenCVForUnity.DnnModule.Dnn.shrinkCaffeModel(src.Value, dst.Value, wrapped_layersTypes);

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


        }
Ejemplo n.º 26
0
        void DoProcess()
        {
            if (!(owner.Value is DlibFaceLandmarkDetectorPlayMakerActions.DoubleArray))
            {
                owner.Value = new DlibFaceLandmarkDetectorPlayMakerActions.DoubleArray(new System.Double[0]);
            }

            System.Double[] wrapped_owner = DlibFaceLandmarkDetectorPlayMakerActionsUtils.GetWrappedObject <DlibFaceLandmarkDetectorPlayMakerActions.DoubleArray, System.Double[]> (owner);

            storeResult.Resize(wrapped_owner.Length);

            for (int i = 0; i < wrapped_owner.Length; i++)
            {
                storeResult.Set(i, (float)wrapped_owner[i]);
            }
        }
        void DoProcess()
        {
            string[]      string_lexicon  = lexicon.stringValues;
            List <string> wrapped_lexicon = new List <string>(string_lexicon);

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Mat))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Mat();
            }
            ((OpenCVForUnityPlayMakerActions.Mat)storeResult.Value).wrappedObject = OpenCVForUnity.TextModule.Text.createOCRHMMTransitionsTable(vocabulary.Value, wrapped_lexicon);

            for (int i = 0; i < wrapped_lexicon.Count; i++)
            {
                lexicon.Set(i, (string)wrapped_lexicon[i]);
            }
            lexicon.SaveChanges();
        }
Ejemplo n.º 28
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.CharArray))
            {
                owner.Value = new OpenCVForUnityPlayMakerActions.CharArray(new System.Char[0]);
            }

            System.Char[] wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.CharArray, System.Char[]>(owner);

            storeResult.Resize(wrapped_owner.Length);

            for (int i = 0; i < wrapped_owner.Length; i++)
            {
                storeResult.Set(i, (string)wrapped_owner[i].ToString());
            }
            storeResult.SaveChanges();
        }
Ejemplo n.º 29
0
        void DoProcess()
        {
            List <int> wrapped_storeResult = OpenCVForUnity.DnnModule.Dnn.getAvailableTargets(be.Value);

            if (!storeResult.IsNone)
            {
                if (storeResult.Length != wrapped_storeResult.Count)
                {
                    storeResult.Resize(wrapped_storeResult.Count);
                }
                for (int i = 0; i < wrapped_storeResult.Count; i++)
                {
                    storeResult.Set(i, (int)wrapped_storeResult[i]);
                }
                storeResult.SaveChanges();
            }
        }
Ejemplo n.º 30
0
        void DoProcess()
        {
            float[]  float_vals  = vals.floatValues;
            double[] casted_vals = new double[float_vals.Length];
            float_vals.CopyTo(casted_vals, 0);

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.Range))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.Range();
            }
            ((OpenCVForUnityPlayMakerActions.Range)storeResult.Value).wrappedObject = new OpenCVForUnity.CoreModule.Range(casted_vals);

            for (int i = 0; i < casted_vals.Length; i++)
            {
                vals.Set(i, (float)casted_vals[i]);
            }
            vals.SaveChanges();
        }