Пример #1
0
    /// <summary>
    /// 音声入力デバイス選択待機
    /// </summary>
    protected void Init()
    {
        // コマンドライン引数
        DeviceName = CommandLineArgs.AudioInputDevice;
        if (DeviceName != null)
        {
            if (DeviceName == "" || Microphone.devices.Contains(DeviceName))
            {
                StartRecording();
            }
            else
            {
                Canvas.DisplayMessage($"Device named “{DeviceName}” do not exists.");
                DeviceName = null;
            }
        }
        else if (CommandLineArgs.HideTextDefault)
        {
            return;
        }

        if (DeviceName == null)
        {
            StartCoroutine("SelectMicrophone");
        }

        // 平滑化初期化
        // 参考:https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?doc_utils_the_smoother_utility.html
        SenseManager = SenseManager.CreateInstance();
        Smoother     = Smoother.CreateInstance(SenseManager.Session);
        SmoothMouth  = Smoother.Create1DWeighted(5);

        MonitorMicrophone();
    }
Пример #2
0
    protected void Init()
    {
        try
        {
            // RealSense初期化
            // 参考:https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?doc_face_general_procedure.html
            // 参考:.\Intel\RSSDK\sample\core\RawStreams.unity
            SenseManager = SenseManager.CreateInstance();

            FaceModule = FaceModule.Activate(SenseManager);
            FaceModule.FrameProcessed += FaceModule_FrameProcessed;
            FaceData = FaceModule.CreateOutput();

            FaceConfig = FaceModule.CreateActiveConfiguration();
            FaceConfig.TrackingMode = TrackingModeType.FACE_MODE_COLOR;
            FaceConfig.Expressions.Properties.Enabled = true;
            FaceConfig.ApplyChanges();

            SampleReader = SampleReader.Activate(SenseManager);
            SampleReader.EnableStream(StreamType.STREAM_TYPE_COLOR, 640, 480, 30);
            SampleReader.SampleArrived += SampleReader_SampleArrived;

            SenseManager.Init();
            SenseManager.StreamFrames(false);

            // RawStreams
            Texture = NativeTexturePlugin.Activate();
            Material.mainTexture      = new Texture2D(640, 480, TextureFormat.BGRA32, false);
            Material.mainTextureScale = new Vector2(-1, -1);
            TexPtr = Material.mainTexture.GetNativeTexturePtr();

            // 解像度取得
            StreamProfileSet profile;
            SenseManager.CaptureManager.Device.QueryStreamProfileSet(out profile);
            Resolution = profile.color.imageInfo;

            // 平滑化初期化
            // 参考:https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?doc_utils_the_smoother_utility.html
            Smoother = Smoother.CreateInstance(SenseManager.Session);

            SmoothBody      = Smoother.Create3DWeighted(BodyPosSmoothWeight);
            SmoothHead      = Smoother.Create3DWeighted(HeadAngSmoothWeight);
            SmoothEyes      = Smoother.Create2DWeighted(EyesPosSmoothWeight);
            SmoothEyesClose = Smoother.Create1DWeighted(EyesCloseSmoothWeight);
            SmoothBrowRai   = Smoother.Create1DWeighted(FaceSmoothWeight);
            SmoothBrowLow   = Smoother.Create1DWeighted(FaceSmoothWeight);
            SmoothSmile     = Smoother.Create1DWeighted(FaceSmoothWeight);
            SmoothKiss      = Smoother.Create1DWeighted(FaceSmoothWeight);
            SmoothMouth     = Smoother.Create1DWeighted(FaceSmoothWeight);
            SmoothTongue    = Smoother.Create1DWeighted(FaceSmoothWeight);
        }
        catch (Exception e)
        {
            ErrorLog.text  = "RealSense Error\n";
            ErrorLog.text += e.Message;
        }
    }
Пример #3
0
    /// <summary>
    /// 音声入力デバイス選択待機
    /// </summary>
    protected void Init()
    {
        StartCoroutine("SelectMicrophone");

        // 平滑化初期化
        // 参考:https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?doc_utils_the_smoother_utility.html
        Session     = Session.CreateInstance();
        Smoother    = Smoother.CreateInstance(Session);
        SmoothMouth = Smoother.Create1DWeighted(5);
    }