예제 #1
0
    void Start()
    {
        //_camera = transform.parent.parent.GetComponent<RosConnector>().RosSocket;_camera = transform.parent.parent.GetComponent<RosConnector>().RosSocket;
        //find the rosconnector used in the drone. it should only exist one connection (i think)
        toPublish = new CameraImagePublisher2(GameObject.Find("drone").GetComponent <RosConnector>().RosSocket, publishTopic, qualityLevel);
        //toPublishDepth = new CameraImagePublisher2(GameObject.Find("drone").GetComponent<RosConnector>().RosSocket,depthPublishTopic,qualityLevel);

        _camera          = this.GetComponent <Camera>();
        resolutionHeight = _camera.targetTexture.height;
        resolutionWidth  = _camera.targetTexture.width;


        texture2D = new Texture2D(resolutionWidth, resolutionHeight, TextureFormat.RGB24, false);
        //depthTexture2D = new Texture2D(resolutionWidth, resolutionHeight, TextureFormat.RGB24, false);
        rect = new Rect(0, 0, resolutionWidth, resolutionHeight);

        //for depth image
        _camera.depthTextureMode = DepthTextureMode.Depth;
    }