Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Visualizer ViewControl causing eigen crash

Open Jason420Git opened this issue 7 years ago • 6 comments

v0.5 (also tested on 0.3) MSVC 2015 Windows 10

Describe the bug I get a runtime error using the Visualizer. It appears in ViewControl::setMatrices() I am finding that the window height and width are 0, occasionally undefined. The function which sets these I went through and their value remains unchanged directly after assigning to them. The code I am running is as follows:

std::shared_ptr<open3d::PointCloud> m_cloud;
open3d::Visualizer m_visualiser;
m_visualiser.CreateVisualizerWindow("PointCloud", 1080, 720);
m_visualiser.AddGeometry(m_cloud); <- usually crashes here

Sometimes crashes later

m_visualiser.UpdateGeometry();
m_visualiser.PollEvents();
m_visualiser.UpdateRender();

I get the following stacktrace:


 	main.exe!Eigen::internal::cast_impl<double,float>::run(const double & x) Line 330	C++
 	main.exe!Eigen::internal::cast<double,float>(const double & x) Line 340	C++
 	main.exe!Eigen::internal::scalar_cast_op<double,float>::operator()(const double & a) Line 392	C++
 	main.exe!Eigen::CwiseUnaryOpImpl<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const ,Eigen::Dense>::coeff(__int64 index) Line 115	C++
 	main.exe!Eigen::DenseCoeffsBase<Eigen::Matrix<float,4,4,0,4,4>,1>::copyCoeff<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(__int64 index, const Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 495	C++
 	main.exe!Eigen::internal::assign_LinearTraversal_CompleteUnrolling<Eigen::Matrix<float,4,4,0,4,4>,Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const >,0,16>::run(Eigen::Matrix<float,4,4,0,4,4> & dst, const Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > & src) Line 181	C++
 	main.exe!Eigen::internal::assign_impl<Eigen::Matrix<float,4,4,0,4,4>,Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const >,1,2,0>::run(Eigen::Matrix<float,4,4,0,4,4> & dst, const Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > & src) Line 315	C++
>	main.exe!Eigen::DenseBase<Eigen::Matrix<float,4,4,0,4,4> >::lazyAssign<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(const Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 509	C++
 	main.exe!Eigen::PlainObjectBase<Eigen::Matrix<float,4,4,0,4,4> >::lazyAssign<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(const Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 415	C++
 	main.exe!Eigen::internal::assign_selector<Eigen::Matrix<float,4,4,0,4,4>,Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const >,0,0>::run(Eigen::Matrix<float,4,4,0,4,4> & dst, const Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > & other) Line 527	C++
 	main.exe!Eigen::PlainObjectBase<Eigen::Matrix<float,4,4,0,4,4> >::_set_noalias<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(const Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 654	C++
 	main.exe!Eigen::PlainObjectBase<Eigen::Matrix<float,4,4,0,4,4> >::PlainObjectBase<Eigen::Matrix<float,4,4,0,4,4> ><Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(const Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 538	C++
 	main.exe!Eigen::Matrix<float,4,4,0,4,4>::Matrix<float,4,4,0,4,4><Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > >(const Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double,float>,Eigen::Matrix<double,4,4,0,4,4> const > > & other) Line 380	C++
 	main.exe!open3d::GLHelper::Perspective(double field_of_view_, double aspect, double z_near, double z_far) Line 66	C++
 	main.exe!open3d::ViewControl::SetViewMatrices(const Eigen::Matrix<double,4,4,0,4,4> & model_matrix) Line 60	C++
 	main.exe!open3d::Visualizer::Render() Line 71	C++
 	main.exe!open3d::Visualizer::WindowRefreshCallback(GLFWwindow * window) Line 35	C++
 	main.exe!open3d::Visualizer::CreateVisualizerWindow::__l2::<lambda>(GLFWwindow * window) Line 135	C++
 	main.exe!void <lambda>(GLFWwindow *)::<lambda_invoker_cdecl>(GLFWwindow * window) Line 135	C++
 	main.exe!_glfwInputWindowDamage(_GLFWwindow * window) Line 127	C
 	main.exe!windowProc(HWND__ * hWnd, unsigned int uMsg, unsigned __int64 wParam, __int64 lParam) Line 986	C

image

Jason420Git avatar Jan 31 '19 11:01 Jason420Git

This is weird. I have never seen this before. Are you building Open3D in x64 mode? Also, try to compile dependency libraries from source. You can try to run the example of Tools/ViewGeometry and see if that can open a window.

qianyizh avatar Feb 01 '19 06:02 qianyizh

I can run the visualizer example yes.

It is weird for us too. We did not change any code. The main difference is switching from OpenVino R3 to R5 and updating Open3D to 0.5. I have seen this problem on 2 different PCs. Yes building in x64

cmake -G "Visual Studio 14 2015 Win64" -DSTATIC_WINDOWS_RUNTIME=ON ..

Jason420Git avatar Feb 01 '19 09:02 Jason420Git

Doing some testing on this at the moment. I am using my own version of eigen3 but open3d is using its 3rd party built one. Could this be a problem?

I noticed that the Cmake does not actually allow me to use my own eigen without modifying it.

if (BUILD_EIGEN3)
    message(STATUS "Building EIGEN3 from source (BUILD_EIGEN3=ON)")
elseif (EIGEN3_FOUND)
    message(STATUS "Using installed EIGEN3 ${EIGEN3_VERSION}")
else ()
    message(STATUS "Unable to find EIGEN3 installed in the system")
    message(STATUS "Building EIGEN3 from source")
    set(BUILD_EIGEN3 ON)
endif ()

if (BUILD_EIGEN3)
    set(EIGEN3_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/3rdparty/Eigen")
    INSTALL_HEADERS(Eigen)
endif ()

This code will always build Eigen3 unless EIGEN3_FOUND is true. But there is no code to initialise that variable so it will always be false. There would need to be a call to find package or similar above this section.

Jason420Git avatar Feb 12 '19 11:02 Jason420Git

We have managed to get around it in Windows with the line:

#define EIGEN_DONT_ALIGN_STATICALLY

Defined in our main.cpp. However this then causes issues for our Linux developer.

Jason420Git avatar Feb 12 '19 15:02 Jason420Git

@takanokage: Could you check if this is related to the Eigen Alignment Issue?

syncle avatar Feb 12 '19 18:02 syncle

Issue closed due to lack of activity. Feel free to open a new issue if you still consider this is a critical matter.

germanros1987 avatar Jul 27 '20 23:07 germanros1987