private void UpdateInitPose(Camera cam) { // Get the VisionLib transformation from the Unity camera VLUnityCameraHelper.CameraToVLPose( cam, this.rotCamera, out this.t, out this.q); // Convert the transformation into JSON this.initPose.Set(t, q); this.initPoseString = VLJsonUtility.ToJson(this.initPose, this.prettyPrint); }
/// <summary> /// Returns the current transformation of the Camera component in /// VisionLib coordinates as JSON string. /// </summary> /// <returns> /// JSON string with initial pose in VisionLib coordinates. /// </returns> public string GetInitPoseJson() { if (!this.InitWorkerReference()) { return(""); } // Get the VisionLib transformation from the camera component Vector4 t; Quaternion q; VLUnityCameraHelper.CameraToVLPose( this.cam, this.rotCamera, out t, out q, this.workerBehaviour.flipCoordinateSystemHandedness); // Convert the transformation into JSON InitPose param = new InitPose(t.x, t.y, t.z, q.x, q.y, q.z, q.w); return(VLJsonUtility.ToJson(param, this.prettyPrint)); }