void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.ClassificationModel))
            {
                LogError("owner is not initialized. Add Action \"newClassificationModel\".");
                return;
            }
            OpenCVForUnity.DnnModule.ClassificationModel wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ClassificationModel, OpenCVForUnity.DnnModule.ClassificationModel>(owner);

            storeResult.Value = wrapped_owner.getEnableSoftmaxPostProcessing();

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

            if (!(storeResult.Value is OpenCVForUnityPlayMakerActions.ClassificationModel))
            {
                storeResult.Value = new OpenCVForUnityPlayMakerActions.ClassificationModel();
            }
            ((OpenCVForUnityPlayMakerActions.ClassificationModel)storeResult.Value).wrappedObject = wrapped_owner.setEnableSoftmaxPostProcessing(enable.Value);
        }
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.ClassificationModel))
            {
                LogError("owner is not initialized. Add Action \"newClassificationModel\".");
                return;
            }
            OpenCVForUnity.DnnModule.ClassificationModel wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.ClassificationModel, OpenCVForUnity.DnnModule.ClassificationModel>(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);

            int[] int_classId    = classId.intValues;
            int[] casted_classId = new int[int_classId.Length];
            for (int i = 0; i < casted_classId.Length; i++)
            {
                casted_classId[i] = (int)int_classId[i];
            }

            float[] float_conf  = conf.floatValues;
            float[] casted_conf = new float[float_conf.Length];
            for (int i = 0; i < casted_conf.Length; i++)
            {
                casted_conf[i] = (float)float_conf[i];
            }

            wrapped_owner.classify(wrapped_frame, casted_classId, casted_conf);

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

            for (int i = 0; i < casted_conf.Length; i++)
            {
                conf.Set(i, (float)casted_conf[i]);
            }
            conf.SaveChanges();
        }
 public ClassificationModel(OpenCVForUnity.DnnModule.ClassificationModel nativeObj) : base(nativeObj)
 {
 }