1
Python and Java API / Java API: Metashape 1.8.2 - point coordinates of pointcloud wrong
« on: March 23, 2022, 02:46:54 PM »
Hey everybody,
I updated the Metashape JAR in my java project to version 1.8.2. and run into a problem. I generated a georeferenced point cloud with ground control points. When I open the project everything is fine.
However, if I like to continue working with the java code and print the trackID + coordinates of my (sparse) point cloud, e.g. using this command:
I get an weird result like this:
ID,X,Y,Z
1617,-1.001014896494884E-14, 0.007812505590406374, 3.4312671939913E-311
1618,-1.4160203828280833E-14, 0.007812505591220983, 3.4333891897823E-311
1619,-3.233755625624215E-14, 0.007812505590504133, 3.4355111855733E-311
1620,-2.344639034314182E-14, 0.007812505590581154, 3.437633181364E-311
[...]
Almost all coordinates are 0,0,0 (rounded). When I open the project in the GUI, I can see the correctly determined sparse cloud (coordinates are as expected...).
Furthermore, I got an error when I try to calculate the reprojection error by camera.getError (pt (3D), proj (2)) -> "Exception in thread "main" java.lang.IllegalArgumentException: invalid array length" using the Vector from points.get(pointIdx).getCoord(). The 2D projections look good and plausible.
The entire procedure worked before the update!
What I´m doing wrong now?
Thank you very much!
I updated the Metashape JAR in my java project to version 1.8.2. and run into a problem. I generated a georeferenced point cloud with ground control points. When I open the project everything is fine.
However, if I like to continue working with the java code and print the trackID + coordinates of my (sparse) point cloud, e.g. using this command:
Quote
for (int p = 0; p < pointCloud.get().getPoints().get().getSize(); p++) {
PointCloud.Point pp = pointCloud.get().getPoints().get().get(p);
System.out.println(pp.getTrackId() + ","+ pp.getCoord().getX() + "," + pp.getCoord().getY() +","+pp.getCoord().getZ());
}
I get an weird result like this:
ID,X,Y,Z
1617,-1.001014896494884E-14, 0.007812505590406374, 3.4312671939913E-311
1618,-1.4160203828280833E-14, 0.007812505591220983, 3.4333891897823E-311
1619,-3.233755625624215E-14, 0.007812505590504133, 3.4355111855733E-311
1620,-2.344639034314182E-14, 0.007812505590581154, 3.437633181364E-311
[...]
Almost all coordinates are 0,0,0 (rounded). When I open the project in the GUI, I can see the correctly determined sparse cloud (coordinates are as expected...).
Furthermore, I got an error when I try to calculate the reprojection error by camera.getError (pt (3D), proj (2)) -> "Exception in thread "main" java.lang.IllegalArgumentException: invalid array length" using the Vector from points.get(pointIdx).getCoord(). The 2D projections look good and plausible.
The entire procedure worked before the update!
What I´m doing wrong now?
Thank you very much!