gpt4 book ai didi

java - 调用 TangoSupport.transformPointCloud(transform.matrix, pointCloud) 时 Tango Java 应用程序崩溃

转载 作者:行者123 更新时间:2023-12-01 08:50:52 25 4
gpt4 key购买 nike

我是 Google Tango 开发的新手,我正在尝试将多个点云压缩为一个。为此,我构建了以下代码:

for (int i = 0; i < mPointCloudList.size(); ++i) {

TangoPointCloudData pointCloud = mPointCloudList.get(i);

TangoSupport.TangoMatrixTransformData transform =
TangoSupport.getMatrixTransformAtTime(pointCloud.timestamp,
TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH,
TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,
TangoSupport.TANGO_SUPPORT_ENGINE_TANGO,
TangoSupport.ROTATION_IGNORED);

TangoPointCloudData pcd = TangoSupport.transformPointCloud(transform.matrix, pointCloud);

int numPoints = pcd.numPoints;

if (numPoints != 0) {
int numFloats = 4 * numPoints;
for (int j = 0; j < numFloats; j = j + 4) {
myOutWriter.write(String.format("v %f %f %f\n", pcd.points.get(j),
pcd.points.get(j), pcd.points.get(j + 2)));
}
}
}

我不确定代码是否正确。但是,我在这里的原因是因为当我运行此代码时,TangoSupport.transformPointCloud(transform.matrix, pointCloud) 调用会使应用程序崩溃。我得到的错误:

A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7f61830000 in tid 14384 (.javapointcloud)

关于如何解决此问题或如何解决此问题有什么想法吗?

谢谢!

最佳答案

我设法通过这样做解决这个问题:

TangoSupport.TangoMatrixTransformData transform =
TangoSupport.getMatrixTransformAtTime(pointCloud.timestamp,
TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH,
TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,
TangoSupport.TANGO_SUPPORT_ENGINE_TANGO,
TangoSupport.ROTATION_IGNORED);

if (transform.statusCode == TangoPoseData.POSE_VALID) {
int numPoints = pointCloud.numPoints;
Vector3 point = new Vector3(0f, 0f, 0f);

double dTransformMatrix[] = new double[transform.matrix.length];

for (int k = 0; k < transform.matrix.length; k++) {
dTransformMatrix[k] = (double) transform.matrix[k];
}

if (numPoints != 0) {
int numFloats = 4 * numPoints;
for (int j = 0; j < numFloats; j = j + 4) {
if (pointCloud.points.get(j + 3) >= 0.5) {
point.x = pointCloud.points.get(j);
point.y = pointCloud.points.get(j + 1);
point.z = pointCloud.points.get(j + 2);
point = point.multiply(dTransformMatrix);
myOutWriter.write(String.format("v %f %f %f\n", point.x, point.y, point.z));
}
}
}
}

关于java - 调用 TangoSupport.transformPointCloud(transform.matrix, pointCloud) 时 Tango Java 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42416322/

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