问题描述
我有同一建筑物的两个点云。然而,一个要小得多,所以它们的比例不同,而且方向也不同。
我想一口气缩放一个点云,以便大小匹配。然后自动将相同的云注册到另一个点云。
我在 probreg 中查看了 Demo : Bayesian Coherent Point Drift。但我不确定它是否可以缩放。
有人可以建议我这样做的方法吗?
这是我的代码:
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])
target.paint_uniform_color([0,1,0])
result.paint_uniform_color([0,1])
o3.visualization.draw_geometries([source,target,result])
这是我的错误:
$ python3 cpd.py
Traceback (most recent call last):
File "cpd.py",line 19,in <module>
tf_param,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')
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)