gpt4 book ai didi

java - 在 Query Vertices() 中获取空值 - 英特尔实感 F200

转载 作者:行者123 更新时间:2023-12-01 09:59:58 25 4
gpt4 key购买 nike

我想从 QueryVertices() 找到坐标,但在执行时得到空值。

代码片段-

public class CameraViewer2
{
static int cWidth = 640; //Color image width
static int cHeight = 480; //Color image height
static int dWidth, dHeight; //depth image width and height
static boolean exit = false;//flag

public static void main(String s[])
{

PXCMSenseManager senseMgr = PXCMSenseManager.CreateInstance(); //Create a session manager instance
pxcmStatus sts = senseMgr.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, cWidth, cHeight); //STREAM_TYPE_COLOR The color stream.
sts = senseMgr.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH,cWidth,cHeight); //STREAM_TYPE_DEPTH The depth stream.
sts = senseMgr.Init(); //initialize the Manager

//getting the profile data
PXCMCapture.Device device = senseMgr.QueryCaptureManager().QueryDevice();
PXCMCapture.Device.StreamProfileSet profiles = new PXCMCapture.Device.StreamProfileSet();
device.QueryStreamProfileSet(profiles);

dWidth = profiles.depth.imageInfo.width;
dHeight = profiles.depth.imageInfo.height;

Listener listener = new Listener();

if (sts == pxcmStatus.PXCM_STATUS_NO_ERROR)
{
while (listener.exit == false)
{
sts = senseMgr.AcquireFrame(true); //Wait until a new frame is available and lock it for processing.
if (sts == pxcmStatus.PXCM_STATUS_NO_ERROR)
{
PXCMCapture.Sample sample = senseMgr.QuerySample(); // retrieve the color and depth samples aligned
if (sample.color != null)
{
PXCMImage depth= sample.depth;
PXCMImage color= sample.color;
PXCMProjection projection=device.CreateProjection();// Create the PXCMProjection instance.
PXCMImage mappedColorImage=projection.CreateColorImageMappedToDepth( depth, color);

PXCMPoint3DF32[] vertices = new PXCMPoint3DF32[cWidth * cHeight];
System.out.println(projection.QueryVertices(depth, vertices)); //getting in console- PXCM_STATUS_NO_ERROR

是否还有其他方法可以获取坐标。任何帮助将不胜感激。

提前致谢。

最佳答案

您的顶点数组应该是深度图像的大小,而不是彩色图像的大小,因为您为深度图像中的每个像素获取一个顶点。因此,请改用 PXCMPoint3DF32[] vertices = new PXCMPoint3DF32[dWidth * dHeight];

关于java - 在 Query Vertices() 中获取空值 - 英特尔实感 F200,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36884782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com