Exemple #1
0
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option('-n',
                      '--number',
                      dest='pointNum',
                      help='number of points in the point cloud',
                      type='int',
                      default=256)
    parser.add_option('-p',
                      '--plot',
                      dest='plot',
                      action='store_true',
                      help='visualize icp result',
                      default=False)
    parser.add_option('-c',
                      '--core',
                      dest='coreNum',
                      help='number of threads used in the cuda',
                      type='int',
                      default=0)
    (options, args) = parser.parse_args()
    pc1 = PointCloud()
    pc1.initFromRand(options.pointNum, 0, 1, 10, 20, 0, 1)
    pc2 = PointCloud(pc1)
    pc2.applyTransformation()
    icpSolver = ICPParallel(pc1,
                            pc2,
                            numCore=options.coreNum,
                            plot=options.plot)
    icpSolver.solve()
Exemple #2
0
            indexArray[resultIndex] = minIndex
            totalDistance += minDistance

        return totalDistance, PointCloud(self.dst.points[indexArray, 0:3])





if __name__ == '__main__':
    """
    When icp.py is used as main module,
    - Create a random PointClound pc1
    - Create a another PointCloud pc2 as a random transformation from pc1
    - Compute the ICP between them
    """
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option('-n', '--number', dest='pointNum', help='number of points in the point cloud', type='int', default=256)
    parser.add_option('-p', '--plot', dest='plot', action='store_true', help='visualize icp result', default=False)
    (options, args) = parser.parse_args()
    pc1 = PointCloud()
    pc1.initFromRand(options.pointNum, 0, 10, 10, 11, 20, 100)
    pc2 = PointCloud(pc1)
    pc2.applyTransformation()
    icpSolver = ICP(pc1, pc2, plot=options.plot)
    icpSolver.solve()