- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the document, we can get the focal length of the depth camera from the function QueryDepthFocalLengthMM. However, I do not know how to use it. Could anyone can show me the example code to get the focal length? Thank you!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is how I do it in C# with Unity:
using UnityEngine; using System.Collections; using System.Collections.Generic; public class Example: MonoBehaviour { // Color Image info public int colorWidth = 848; public int colorHeight = 480; public float colorFPS = 60f; // Depth Image info public int depthWidth = 640; public int depthHeight = 480; public float depthFPS = 60f; // psm is the manager that controls access to streams, acquiring frames, etc PXCMSenseManager psm; void Start() { psm = PXCMSenseManager.CreateInstance(); if(psm == null) { Debug.LogError("Unable to create the PXCSenseManager"); return; } // tell the PSM that we want to enable depth at this resolution and fps if(psm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH, depthWidth, depthHeight, depthFPS) != pxcmStatus.PXCM_STATUS_NO_ERROR) { Debug.LogError("Unable to start depth stream"); return; } // tell the PSM that we want to enable color at this resolution and fps if(psm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, colorWidth, colorHeight, colorFPS) != pxcmStatus.PXCM_STATUS_NO_ERROR) { Debug.LogError("Unable to start depth stream"); return; } // initialize the PSM if(psm.Init() != pxcmStatus.PXCM_STATUS_NO_ERROR) { Debug.Log("Unable to Init the PXCSenseManager"); OnDisable(); // clean up return; } // now we get the focal length: float focalLengthMM = psm.captureManager.device.QueryColorFocalLengthMM(); Debug.Log("Focal length: " + focalLengthMM); } void OnDisable() { if(psm != null) { psm.Dispose(); } } }
Hope that makes sense. Make sure you have imported the SDK into your project as well.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page