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; }
void BlitTexture() { var h = _retrival.TextureData.RawTexture.CombinedTexture; _imageGrabber.SetTexture2D(h.GetRawTextureData(), h.width, h.height / 2, TextureFormat.Alpha8);//,HandRenderer.LeapRetrival [0].Width,HandRenderer.LeapRetrival [0].Height,TextureFormat.Alpha8 _imageGrabber.Update(); }
// Update is called once per frame void Update() { if (_isConnected && _streamer.IsStreaming) { _srcTexWrapper.ConvertTexture(SrcTexture); _imageGrabber.SetTexture2D(_srcTexWrapper.WrappedTexture); _imageGrabber.Update(); } }
void BlitTexture() { if (SourceImage == null) { return; } { _wrapper.ConvertTexture(SourceImage); _sampled = true; } var h = _wrapper.WrappedTexture; _imageGrabber.SetTexture2D(h.GetRawTextureData(), h.width, h.height, h.format);//,HandRenderer.LeapRetrival [0].Width,HandRenderer.LeapRetrival [0].Height,TextureFormat.Alpha8 _imageGrabber.Update(); }
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 OnRenderImage(RenderTexture source, RenderTexture destination) { if (_prepared) { var tempRT = RenderTexture.GetTemporary(source.width, source.height); Graphics.Blit(source, tempRT); if (_tempTex == null) { _tempTex = new Texture2D(source.width, source.height, TextureFormat.RGB24, false); } _tempTex.ReadPixels(new Rect(0, 0, source.width, source.height), 0, 0, false); _tempTex.Apply(); _grabber.SetTexture2D(_tempTex); _grabber.Update(); HasData = true; //_pipe.Write(tempTex.GetRawTextureData()); //Destroy(tempTex); RenderTexture.ReleaseTemporary(tempRT); } Graphics.Blit(source, destination); }
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; }