'Write a point cloud after performing non-ridge registration (pcregistercpd + pctransform) in matlab

I have performed non-ridge registration for two point clouds in matlab. And then I want to merge the two point cloud and write it as a new point cloud. I have tried pcmerge, but pcmerge function only merges point clouds using a box grid filter in the region of overlap.

  1. I want both overlap and not overlap areas
  2. although the overlapping two clouds using pcshowpair function looks promising, the actual print-out clouds are only contain few points each. How can I increase the density of each cloud before merge. Thanks,
    % show two clouds points 
    cleanAdown = pcdownsample(ptCloud1,'gridAverage',0.03);
    cleanBdown = pcdownsample(ptCloud2,'gridAverage',0.03);
    [tform,rmse] = pcregistercpd(cleanAdown,cleanBdown,'Transform',"Nonrigid");
    % alignment
    movingReg = pctransform(cleanAdown,tform); 

    figure;
    pcshowpair(movingReg,cleanBdown,'MarkerSize',50);
    legend({'Moving point cloud','Fixed point cloud'},'TextColor','w');



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source