Tango Java 应用程序在调用 TangoSupport.transformPointCloud(transform.matrix, pointCloud) 时崩溃
Tango Java app crash when calling TangoSupport.transformPointCloud(transform.matrix, pointCloud)
我是 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));
}
}
}
}
我是 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));
}
}
}
}