yangjiaolong / Go-ICP

Implementation of the Go-ICP algorithm for globally optimal 3D pointset registration
http://jlyang.org/go-icp/
GNU General Public License v3.0
430 stars 96 forks source link

Scaling of original point clouds #9

Open mpkuse opened 4 years ago

mpkuse commented 4 years ago

I am a little confused about the scaling part:

Make sure both model and data points are normalized to fit in [-1,1]3 prior to running

I have two point clouds lets call it X (3xN) and Y (3xM). There are in general floats. What is the exact scaling I need to do? Also, do I need to scale the result of go-ICP back (inverse scaling?)

X_cap := (X - mean_colwise( X ) ) / max_colwise( X ) - min_colwise( X )
vma1996 commented 4 years ago

Here you go:

% src == model; tgt == data
% Center to origin
src = src - mean(src, 1);
tgt = tgt - mean(tgt, 1);

% Normalize data
combo = [src; tgt];
combo = rescale(combo,[-1 -1 -1], [1 1 1]);

% Get back normalized Source and Target
src = combo(1:size(src, 1), :);
tgt = combo(size(src, 1) + 1:end, :);
aalavandhaann commented 3 years ago

The exact idea here is that your point clouds need to be within the 1x1x1 dimension bounds for the algorithm to work correctly. So find the maximum bounds of is in x, y, or z and scale it to be within 1 and other dimensions scale proportionally. I guess @vma1996 is doing the exact thing via the given code example. Close the issue of it solves our answers your problem.

Regards,

0K