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

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

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

            storeResult.Value = wrapped_owner.train(wrapped_samples, layout.Value, wrapped_responses);

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }
Ejemplo n.º 2
0
        void DoProcess()
        {
            if (!(owner.Value is OpenCVForUnityPlayMakerActions.StatModel))
            {
                LogError("owner is not initialized. Add Action \"newStatModel\".");
                return;
            }
            OpenCVForUnity.MlModule.StatModel wrapped_owner = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.StatModel, OpenCVForUnity.MlModule.StatModel>(owner);

            if (!(trainData.Value is OpenCVForUnityPlayMakerActions.TrainData))
            {
                LogError("trainData is not initialized. Add Action \"newTrainData\".");
                return;
            }
            OpenCVForUnity.MlModule.TrainData wrapped_trainData = OpenCVForUnityPlayMakerActionsUtils.GetWrappedObject <OpenCVForUnityPlayMakerActions.TrainData, OpenCVForUnity.MlModule.TrainData>(trainData);

            storeResult.Value = wrapped_owner.train(wrapped_trainData, flags.Value);

            Fsm.Event(storeResult.Value ? trueEvent : falseEvent);
        }