0

I have two point clouds of the same building. One however is much smaller, so they are not of the same scale, and it is also at a different orientation.

I want to in one swoop, scale one point cloud so that the sizes match. and then automatically register the same cloud to the other point cloud.

I looked at Demo : Bayesian Coherent Point Drift in probreg. but i'm not sure if it does the scaling.

Can someone please suggest a way I can do this?

this is my code:

import copy
import numpy as np
import open3d as o3
from probreg import cpd

# load source and target point cloud
source = o3.io.read_point_cloud('ovslam1.pcd')
target = copy.deepcopy('bim1.pcd')

# compute cpd registration
tf_param, _, _ = cpd.registration_cpd(source, target)
result = copy.deepcopy(source)
result.points = tf_param.transform(result.points)

# draw result
source.paint_uniform_color([1, 0, 0])
target.paint_uniform_color([0, 1, 0])
result.paint_uniform_color([0, 0, 1])
o3.visualization.draw_geometries([source, target, result])

this is my error:

$ python3 cpd.py 
Traceback (most recent call last):
  File "cpd.py", line 19, in <module>
    tf_param, _, _ = cpd.registration_cpd(source, target)
  File "/home/joe/.local/lib/python3.8/site-packages/probreg/cpd.py", line 281, in registration_cpd
    return cpd.registration(cv(target),
  File "/home/joe/.local/lib/python3.8/site-packages/probreg/cpd.py", line 84, in registration
    res = self._initialize(target)
  File "/home/joe/.local/lib/python3.8/site-packages/probreg/cpd.py", line 117, in _initialize
    sigma2 = self._squared_kernel_sum(self._source, target)
  File "/home/joe/.local/lib/python3.8/site-packages/probreg/math_utils.py", line 25, in squared_kernel_sum
    return _math.squared_kernel(x, y).sum() / (x.shape[0] * x.shape[1] * y.shape[0])
TypeError: squared_kernel(): incompatible function arguments. The following argument types are supported:
    1. (arg0: numpy.ndarray[numpy.float32[m, n]], arg1: numpy.ndarray[numpy.float32[m, n]]) -> numpy.ndarray[numpy.float32[m, n]]

Invoked with: array([[  2.63302541,  -2.03959942, -21.31122589],
       [  2.77799726,  -2.06889749, -21.75521278],
       [  2.83439279,  -1.22657204, -21.78207016],
       ...,
       [ -3.28682041,  -0.90619814,  16.61546516],
       [ -3.30297685,  -0.90664768,  16.64566422],
       [ -3.24951434,  -0.87377918,  16.65137482]]), array('bim1.pcd', dtype='<U8')
jtm101
  • 85
  • 6
  • 1
    Please provide a link with your code attempt. I assume with demo you mean https://github.com/neka-nat/probreg ? the readme states that noise test already does move, rotate and scale testing. Also a link to your point clouds would be good. – areop-enap Feb 25 '21 at 11:51
  • this is my code attempt, however it doesnt work: – jtm101 Mar 01 '21 at 09:26

0 Answers0