Exemple #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;
    }
Exemple #2
0
    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;
    }
    // Use this for initialization
    void Start()
    {
        if (RobotConnector == null)
        {
            RobotConnector = gameObject.GetComponent <RobotConnectionComponent>();
        }
        _isConnected = false;
        _handsPort   = 7010;
        //if (HandRenderer == null)
        //	HandRenderer = GetComponent<LeapMotionRenderer> ();
        RobotConnector.AddDependencyNode(this);

        if (RobotConnector.IsRobotStarted())
        {
            OnRobotConnected(RobotConnector.Robot, RobotConnector.Ports);
        }

        if (SourceImage == null)
        {
            SourceImage = Utilities.WhiteTexture;
        }

        _imageGrabber = new GstUnityImageGrabber();
        //         _textureSource = new WebCamTexture(1280,720);
        //         _textureSource.Play();
    }
    protected override void Start()
    {
//		_material = new Material(_shader);
        _grabber = new GstUnityImageGrabber();
        _width   = Screen.width;
        _height  = Screen.height;

        base.Start();
    }
 public void SetGrabber(GstUnityImageGrabber grabber)
 {
     _grabber = grabber;
     if (grabber != null)
     {
         mray_gst_customImageStreamerSetGrabber(m_Instance, grabber.Instance);
     }
     else
     {
         mray_gst_customImageStreamerSetGrabber(m_Instance, System.IntPtr.Zero);
     }
 }
Exemple #6
0
    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;
    }
    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;
    }
 public void SetGrabber(GstUnityImageGrabber grabber)
 {
     _grabber = grabber;
     mray_gst_netStreamerSetGrabber (m_Instance, grabber.Instance);
 }
 public void SetGrabber(GstUnityImageGrabber grabber)
 {
     _grabber = grabber;
     mray_gst_netStreamerSetGrabber(m_Instance, grabber.Instance);
 }