gadomski / cpd

C++ implementation of the Coherent Point Drift point set registration algorithm.
http://www.gadom.ski/cpd
GNU General Public License v2.0
396 stars 124 forks source link

Add unlinked normalization #113

Closed gadomski closed 7 years ago

gadomski commented 7 years ago

Unlinked normalization is when each point set has its own scaling factor. Unlinked is good for things like photogrammetry, where the points will most likely need to be scaled. Linked is good for LiDAR, where you (usually) don't want to scale the points.

Fixed #112.

alexsmartens commented 7 years ago

Hi Pete, Thanks for this cahnge. I am about to test it. I've built the updated CPD. Now, trying to build the example. Cannot build the example with jsoncppp There is a change in Cmake file

${CPD_WITH_JSONCPP} is false although I built CPD with jsoncppp What would be the proper way to alter this?

gadomski commented 7 years ago

Did you install cpd with jsoncpp? You have to install so that the new cmake configuration script is put into the correct place.

I can check this (on my system with my installation paths) via:

$ grep CPD_WITH ~/local/lib/cmake/cpd/cpd-config.cmake
set(CPD_WITH_FGT ON)
set(CPD_WITH_JSONCPP ON)
if(${CPD_WITH_FGT})
        if(${CPD_WITH_JSONCPP})
alexsmartens commented 7 years ago

It looks like in my case I do not have jsoncpp ON. Here is my output:

$ grep CPD_WITH /usr/local/lib/cmake/cpd/cpd-config.cmake
set(CPD_WITH_FGT ON)
set(CPD_WITH_JSONCPP )
if(${CPD_WITH_FGT})
        if(${CPD_WITH_JSONCPP})

Although, I built CPD with jsoncpp, and jsoncpp test is passed

$cmake JSONCPP_WITH_CMAKE_PACKAGE=ON BUILD_SHARED_LIBS=ON ..
(I also tested $cmake .., and this did not help)

...
    Start 9: jsoncpp
9/9 Test #9: jsoncpp ..........................   Passed    0.00 sec
gadomski commented 7 years ago

Did you then do a make install to put the cmake script on your system?

alexsmartens commented 7 years ago

Yes, I did

gadomski commented 7 years ago

Can you paste the output of grep CPD_WITH build/cmake/cpd-config.cmake (assuming you're building in a build/ subdirectory)?

alexsmartens commented 7 years ago

I have the same output

$ grep CPD_WITH ~/Downloads/cpd/build/cmake/cpd-config.cmake
set(CPD_WITH_FGT ON)
set(CPD_WITH_JSONCPP )
if(${CPD_WITH_FGT})
        if(${CPD_WITH_JSONCPP})
gadomski commented 7 years ago

Post output of grep WITH_JSONCPP build/CMakeCache.txt please.

alexsmartens commented 7 years ago
$ grep WITH_JSONCPP ~/Downloads/cpd/build/CMakeCache.txt
WITH_JSONCPP:BOOL=ON
gadomski commented 7 years ago

This is a weird one. I cannot reproduce on Ubuntu 16.04.2 LTS:

$ cd build
$ cmake .. -DWITH_JSONCPP=ON >/dev/null && ninja install >/dev/null && grep CPD_WITH_JSONCPP ~/local/lib/cmake/cpd/cpd-config.cmake
set(CPD_WITH_JSONCPP ON)
        if(${CPD_WITH_JSONCPP})
$ cmake .. -DWITH_JSONCPP=OFF >/dev/null && ninja install >/dev/null && grep CPD_WITH_JSONCPP ~/local/lib/cmake/cpd/cpd-config.cmake
set(CPD_WITH_JSONCPP OFF)
        if(${CPD_WITH_JSONCPP})

Are you sure you're installing to the correct place? What does grep CMAKE_INSTALL_PREFIX build/CMakeCache.txt produce? For me:

$ grep CMAKE_INSTALL_PREFIX build/CMakeCache.txt
CMAKE_INSTALL_PREFIX:PATH=/home/ubuntu/local
alexsmartens commented 7 years ago
$ grep CMAKE_INSTALL_PREFIX  ~/Downloads/cpd/build/CMakeCache.txt
CMAKE_INSTALL_PREFIX:PATH=/usr/local

Will try to use cmake command with your prefixes

alexsmartens commented 7 years ago

It looks a bit weird to me, but the problem seems to be a prefix for turning on jsoncpp. I've been using these prefixes form the CPD main page: $cmake JSONCPP_WITH_CMAKE_PACKAGE=ON BUILD_SHARED_LIBS=ON ..

While building the program I added a message to cmake file:

find_package(jsoncpp QUIET)
option(WITH_JSONCPP "Build with jsoncpp" ${jsoncpp_FOUND})
if(WITH_JSONCPP)
    find_package(jsoncpp REQUIRED)
    set(CMAKE_WITH_JSONCPP ON)
    add_subdirectory(components/jsoncpp)
    message (STATUS "jsoncpp " ${jsoncpp_FOUND})
endif() 

So, I was able to trace that, WITH_JSONCPP was always true

The last time I have tried the prefix, which you mentioned in your last post $ cmake .. -DWITH_JSONCPP=ON

And this command seems to work out fine:

$ grep WITH_JSONCPP ~/Downloads/cpd/build/CMakeCache.txt
WITH_JSONCPP:BOOL=ON

$ grep CPD_WITH ~/Downloads/cpd/build/cmake/cpd-config.cmake
set(CPD_WITH_FGT ON)
set(CPD_WITH_JSONCPP ON)
if(${CPD_WITH_FGT})
        if(${CPD_WITH_JSONCPP})
alexsmartens commented 7 years ago

Am I still supposed to run cpd-rigid? If so, I still have the same scaling problem

gadomski commented 7 years ago

Yeah, this pull request doesn't fix that (it turns out). Just switch the order of the point clouds (keep original fixed) and it should work.

alexsmartens commented 7 years ago

I've done some experiments on the previous version. It turns out that CPD sometimes works properly when the scale of a moving model is to be enlarged and sometimes it works properly in the opposite direction. Check out the folder which I shard with you. Hope this will help