Forum

Author Topic: Dense Cloud with JAVA API  (Read 1267 times)

SDUIVM

  • Newbie
  • *
  • Posts: 7
    • View Profile
Dense Cloud with JAVA API
« on: September 20, 2022, 10:54:22 AM »
Hi Everyone,

I am trying to build a dense cloud incrementally using the JAVA API with the following script.

Here a brief description of the code :
I pre align the images using the setTransform method.
I export the dense cloud using the API for each pair of images,
then I parse the exported file for each pair
but it seems that each dense cloud is at the center
and I can't find a way to export the dense cloud in the local coordinate system of the corresponding pair.

// chunk creation
Chunk chunk = doc.addChunk();

// loop over each images
for (int i = 0; i < nimages; i++)
// add image names to the chunk
chunk.addPhotos(names, progress);
// add pose to the image
chunk.getCamera(i).get().setTransform(pose);
                                         
// build dense cloud
System.out.println("----------MATCH PHOTOS---------");
MatchPhotos match_photos = new MatchPhotos();
match_photos.setGenericPreselection(true);                               
match_photos.setKeypointLimit(40000);
match_photos.setTiepointLimit(10000);
match_photos.setResetMatches(false);
match_photos.setKeepKeypoints(true);
match_photos.apply(chunk, progress);
match_photos.delete();

System.out.println("----------ALIGN CAMERAS---------");
AlignCameras align_cameras = new AlignCameras();
align_cameras.apply(chunk, progress);
align_cameras.setResetAlignment(false);
align_cameras.setSubdivideTask(true);
align_cameras.delete();

System.out.println("----------DEPTH MAPS---------");
BuildDepthMaps build_depth_maps = new BuildDepthMaps();
build_depth_maps.setDownscale(4);
build_depth_maps.setReuseDepth(true);
build_depth_maps.setFilterMode(FilterMode.MildFiltering);
build_depth_maps.apply(chunk, progress);
build_depth_maps.delete();

System.out.println("----------DENSE CLOUD---------");
BuildDenseCloud build_dense_cloud = new BuildDenseCloud();
build_dense_cloud.setPointConfidence(false);
build_dense_cloud.setPointColors(true);
build_dense_cloud.getPointColors();
build_dense_cloud.getKeepDepth();
build_dense_cloud.apply(chunk, progress);
build_dense_cloud.delete();

System.out.println("---- densecloud");
ExportPoints exp_points = new ExportPoints();
exp_points.setFormat(PointsFormat.PointsFormatXYZ);
exp_points.setPath("dense.xyz");
exp_points.apply(chunk, progress);
exp_points.delete();

// then I parse the dense.xyz to plot it in a 3D software.


I hope my question is clear.
Thank you very much for help,