コード例 #1
0
    void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports)
    {
        HandController c = GameObject.FindObjectOfType <HandController> ();

        if (c == null || !c.IsConnected())
        {
            return;
        }
        _streamer     = new GstNetworkImageStreamer();
        _imageGrabber = new GstUnityImageGrabber();
        _imageGrabber.SetTexture2D(HandRenderer.LeapRetrival [0].MainTextureData, HandRenderer.LeapRetrival [0].Width, HandRenderer.LeapRetrival [0].Height, TextureFormat.Alpha8);
        _imageGrabber.Update();        //update once

        _handsPort = Settings.Instance.GetPortValue("HandsPort", 0);

        _streamer.SetBitRate(300);
        _streamer.SetResolution(640, 240, 30);
        _streamer.SetGrabber(_imageGrabber);
        _streamer.SetIP(ports.RobotIP, _handsPort, false);
        RobotConnector.Connector.SendData(TxKitHands.ServiceName, "HandPorts", _handsPort.ToString(), false);

        _streamer.CreateStream();
        _streamer.Stream();
        _isConnected = true;
    }
コード例 #2
0
ファイル: TxKitHands.cs プロジェクト: red-pencil/eye-in-hand
    void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports)
    {
        var c = GameObject.FindObjectOfType <LeapServiceProvider> ();

        if (c == null || !c.GetLeapController().IsConnected)
        {
            return;
        }
        _streamer     = new GstNetworkImageStreamer();
        _imageGrabber = new GstUnityImageGrabber();
        Hands2D       = _retrival.TextureData.RawTexture.CombinedTexture;

        BlitTexture();
        _handsPort = Settings.Instance.GetPortValue("HandsPort", 0);

        _streamer.SetBitRate(500);
        _streamer.SetResolution(Hands2D.width, Hands2D.height, 30);
        _streamer.SetGrabber(_imageGrabber);
        _streamer.SetIP(ports.RobotIP, _handsPort, false);
        RobotConnector.Connector.SendData(TxKitHands.ServiceName, "Ports", _handsPort.ToString(), false);

        _streamer.CreateStream();
        _streamer.Stream();
        _isConnected = true;
    }
コード例 #3
0
 void OnRobotDisconnected()
 {
     if (_streamer != null)
     {
         _streamer.Close();
         // _streamer.Destroy();
     }
     _isConnected = false;
     _streamer    = null;
 }
コード例 #4
0
    void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports)
    {
        _streamer = new GstNetworkImageStreamer();

        BlitTexture();
        _handsPort = Settings.Instance.GetPortValue("VisualsPort", 0);

        _streamer.SetBitRate(TargetBitrate, TargetQuality);
        _streamer.SetResolution(SourceImage.width, SourceImage.height, TargetFPS);
        _streamer.SetGrabber(_imageGrabber);
        _streamer.SetIP(ports.RobotIP, _handsPort, false);
        RobotConnector.Connector.SendData(TxKitHands.ServiceName, "Ports", _handsPort.ToString(), false);

        _streamer.CreateStream();
        _streamer.Stream();

        _isConnected = true;
    }
コード例 #5
0
ファイル: TxKitWindow.cs プロジェクト: mrayy/TxKit
    void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports)
    {
        _imageGrabber = new GstUnityImageGrabber();

        _srcTexWrapper.ConvertTexture(SrcTexture);
        _imageGrabber.SetTexture2D(_srcTexWrapper.WrappedTexture);
        _imageGrabber.Update();        //update once


        _videoPort = Settings.Instance.GetPortValue("VideoStreamPort", _videoPort);

        _streamer = new GstNetworkImageStreamer();
        _streamer.SetBitRate(BitRate);
        _streamer.SetResolution(_srcTexWrapper.WrappedTexture.width, _srcTexWrapper.WrappedTexture.height, 30);
        _streamer.SetGrabber(_imageGrabber);
        _streamer.SetIP(ports.RobotIP, _videoPort, false);

        _streamer.CreateStream();
        _streamer.Stream();
        RobotConnector.Connector.SendData(TxKitWindow.ServiceName, "VideoWindowPorts", _videoPort.ToString(), false, false);
        _isConnected = true;
    }
コード例 #6
0
    void OnRobotConnected(RobotConnector.TargetPorts ports)
    {
        HandController c=GameObject.FindObjectOfType<HandController> ();
        if (c == null || !c.IsConnected ()) {
            return;
        }
        _imageGrabber = new GstUnityImageGrabber ();
        _imageGrabber.SetTexture2D (HandRenderer.LeapRetrival [0].MainTextureData,HandRenderer.LeapRetrival [0].Width,HandRenderer.LeapRetrival [0].Height,TextureFormat.Alpha8);
        _imageGrabber.Update();//update once

        _handsPort=Settings.Instance.GetPortValue("HandsPort",0);

        _streamer = new GstNetworkImageStreamer ();
        _streamer.SetBitRate (300);
        _streamer.SetResolution (640, 240, 30);
        _streamer.SetGrabber (_imageGrabber);
        _streamer.SetIP (ports.RobotIP, _handsPort, false);
        RobotConnector.Connector.SendData("HandPorts",_handsPort.ToString(),false);

        _streamer.CreateStream ();
        _streamer.Stream ();
        _isConnected = true;
    }
コード例 #7
0
 void OnRobotDisconnected()
 {
     _isConnected = false;
     _streamer    = null;
 }
コード例 #8
0
 void OnRobotDisconnected()
 {
     _isConnected = false;
     _streamer = null;
 }