Closed maximecharriere closed 3 years ago
It happend when I call CGAL::OpenGR::register_point_sets
or CGAL::OpenGR::compute_registration_transformation
Did you check it with the master branch of Eigen ? https://gitlab.com/libeigen/eigen
I cloned the master branch of Eigen, re-configured and re-build OpenGR, libnabo and libpointmatcher.
I reconfigured the Point_set_processing_3
examples and build the registration_with_OpenGR
project. The same errors as before remained.
I made a walkthrough on how to compile Point_set_processing_3
on Windows with Visual Studio, so you can see if I have made a mistake. Link
The CMakeCach of Point_set_processing_3
: Link
As @Micalson, OpenGR work independently. I ran the script/run-example.bat
from OpenGR and got an suitable result.
I installed the last release (5.1.1) of CGAL with the CGAL-5.1.1-Setup.exe
file.
Could it be a good idea to use the master branch of CGAL?
I have to do registration, and it's been 1 week since I can't figure out how to compile neither registration_with_OpenGR.cpp
nor registration_with_pointmatcher.cpp
examples. I'm thinking of using OpenGR and Point Cloud Library independently, but it's sad not to be able to use the modules normally wrapped in CGAL.
script/run-example.bat
from OpenGRC:\dev\OpenGR\build\install\scripts>..\bin\Super4pcs -i ..\assets\hippo1.obj ..\assets\hippo2.obj -o 0.7 -d 0.01 -t 1000 -n 200 -r super4pcs_fast.obj -m mat_super4pcs_fast.txt
Starting registration
norm_max_dist: 0.01
Initial LCP: 0.005
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
Score: 0.185st: 0.185000
(Homogeneous) Transformation from ..\assets\hippo2.obj to ..\assets\hippo1.obj:
0.7886 -0.106727 -0.605574 -0.130297
0.239014 0.960583 0.141958 0.0248668
0.566553 -0.256688 0.783025 -0.0257741
0 0 0 1
Exporting Matrix to mat_super4pcs_fast.txt...
Export DONE
Exporting Registered geometry to super4pcs_fast.obj...
Export DONE
C:\dev\OpenGR\build\install\scripts>..\bin\Super4pcs -i ..\assets\hippo1.obj ..\assets\hippo2.obj -o 0.7 -d 0.01 -t 1000 -n 200 -r 4pcs_fast.obj -m mat_4pcs_fast.txt -x
Starting registration
norm_max_dist: 0.01
Initial LCP: 0.005
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
sq_max_base_diameter_: 0.476415
Score: 0.545st: 0.545000
(Homogeneous) Transformation from ..\assets\hippo2.obj to ..\assets\hippo1.obj:
0.751759 0.0194035 -0.659153 -0.105058
-0.0448918 0.998754 -0.0217983 0.0160022
0.657909 0.0459776 0.751693 -0.0306218
0 0 0 1
Exporting Matrix to mat_4pcs_fast.txt...
Export DONE
Exporting Registered geometry to 4pcs_fast.obj...
Export DONE
Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
The C compiler identification is MSVC 19.28.29333.0
The CXX compiler identification is MSVC 19.28.29333.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Visual Leak Detector (VLD) is not found.
Using header-only CGAL
Targetting Visual Studio 16 2019
Target build enviroment supports auto-linking
Using VC toolset 142.
Generator uses intermediate configuration directory: $(Configuration)
Boost include dirs: C:/dev/boost_1_74_0/build/include/boost-1_74
Boost libraries:
USING DEBUG CXXFLAGS = '/DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1'
USING DEBUG EXEFLAGS = '/machine:x64 /debug /INCREMENTAL'
USING RELEASE CXXFLAGS = '/DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG'
USING RELEASE EXEFLAGS = '/machine:x64 /INCREMENTAL:NO'
NOTICE : the LAS reader test requires LASlib and will not be compiled.
Configuring done
Do you have more information on the errors? Like the call stacks producing the errors?
@nmellado did you already see that kind of errors?
Could it be that the c++ standard is not properly set, thus we miss cxx11 features ?
In my project properties generated by CMake, it's written that I use C++ 14 Standard. I tried with C++17 but it changed nothing.
I'm currently searching more informations about this issue, like the call stacks, but don't realy know how to do it yet. I'm comming back to you when I have more infos. And if you have any other ideas or are able to reproduce the error, I'd love to hear from you.
Do you have the same behavior if, instead of using cmake to generate a VS project, you directly open the cmake project in VS, and let it configure everything ? https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-160
You give me high hopes ! But unfortunately the same errors have persisted.
Alright, I managed to reproduce the error even on my Linux (for which it used to work), so I'm suspecting a regression from OpenGR (as it used to work before).
It seems that there is now a type that is hard-coded as float
and which conflicts when using double
-typed points as input. One way to fix it in CGAL is to replace
typedef gr::Point3D<typename Kernel::FT> PointType;
by
typedef gr::Point3D<float> PointType;
(And change all occurrences of gr::Point3D<FT>
to gr::Point3D<float>
.)
If I do that, then all compiles fine on my machine, and I guess this should make it work on Windows too.
Of course this might not be a satisfying fix as I would expect gr::Point3D
to accept double (note that we should still make some changes because Kernel::FT
might be neither double nor float, which might cause trouble with other kernels, but it's another problem and it's not the cause here, as the examples use CGAL::Simple_cartesian<double>
).
@nmellado do you see where this could come from? Has there been a recent change with the gr::Point3D
API that could have caused this?
Hum that is really strange, Point3D
is still defined as:
template<typename _Scalar>
class Point3D
The only PR that has been merged since August is this one https://github.com/STORM-IRIT/OpenGR/pull/73 and I see nothing that could cause such regression.
Do you know where is this hardcoded type you mentioned ?
I'm not sure there is a hardcoded type, it was just an intuition. Basically, if I use gr::Point3D<double>
, I get the following error from Eigen:
'ReturnType': is not a member of 'Eigen::ScalarBinaryOpTraits<float,double,Eigen::internal::scalar_product_op<ScalarA,ScalarB>>' C:\dev\eigen-3.3.9\Eigen\src\Core\Product.h
I think this error comes from the fact that float
and double
are mixed (see first 2 template parameters of the type). My guess is that the double
comes from the Point type while float
comes from somewhere else. If I use gr::Point3D<float>
, I don't have this error, so I expect the type have become Eigen::ScalarBinaryOpTraits<float,float, ...>
, which removed the error.
So it's just a guess, I might be wrong. It could also be a problem from the Eigen side. What I find suspicious is that you don't have the bug on OpenGR alone, so I figured it was a typing problem from CGAL and found this float problem.
Ok I'll investigate. It is true that I don't have actual testing for doubles, for maybe there is an explicit initialization somewhere. I'll come back to you ASAP.
@sgiraudot Your fix also works on Windows ! Glad you found a way to the solution. Hope @nmellado finds the cause of the error. I can't really help you, I don't know anything about it.
In registration_with_openGR.cpp
I replace
typedef CGAL::Simple_cartesian<double> K;
by
typedef CGAL::Simple_cartesian<float> K;
data/hippo1.ply
and data/hippo2.ply
are in double, so the program is actually crashing. But I will try to convert them to float to see if the OpenGr functions work fine.
@maximecharriere I may have fixed the bug.
You can try by using OpenGR with the remove-float
branch.
@sgiraudot if you validate these changes I can merge this PR to master
On Windows 10 64bit with MSVC 14.2 (Visual Studio 2019):
:heavy_check_mark: INSTALL OpenGr in Release
:heavy_check_mark: RUN_TESTS in Release (matching
and matching3pcs
didn't work before with the master branch)
:heavy_check_mark: Run registration_with_OpenGR
with Simple_cartesian<double>
kernel
:heavy_exclamation_mark: However, I had to modify a little bit the code of the example in order to make it work. -> My PR 5290
The error is corrected, I close this topic
I reopen issue 5167.
Issue Details
When compilling the
registration_with_OpenGR
example of thePoint_set_processing_3
package, I got 36 Eigen errors. I don't have compiled Eigen because it's a header only library. OpenGR was successfully build.Do you know where it could come from?
Environment
Output errors