zdzhaoyong/GSLAM

error: conversion from ‘cv::Mat’ to non-scalar type ‘GSLAM::GImage’

slamjammin opened this issue · 3 comments

I am receiving the following error when compiling:

/home/nick/Code/gslam/GSLAM/GSLAM/gslam/IO/DatasetNPURGBD.cpp:59:37: error: conversion from ‘cv::Mat’ to non-scalar type ‘GSLAM::GImage’ requested
         GSLAM::GImage img=cv::imread(rgb_file);
                           ~~~~~~~~~~^~~~~~~~~~
/home/nick/Code/gslam/GSLAM/GSLAM/gslam/IO/DatasetNPURGBD.cpp:60:39: error: conversion from ‘cv::Mat’ to non-scalar type ‘GSLAM::GImage’ requested
         GSLAM::GImage depth=cv::imread(d_file,cv::IMREAD_UNCHANGED);

If it is helpful this is my CMAKE output:

cmake ..
-- Compiling GSLAM Version 2.4.7.
-- Build type: Release
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake-qt4 (found version "4.8.7") 
CMake Warning (dev) at /usr/share/cmake-3.13/Modules/FindOpenGL.cmake:270 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  cmake/PICMake.cmake:572 (find_package)
  cmake/PICMake.cmake:453 (pi_collect_packages)
  CMakeLists.txt:26 (pi_add_target)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found OpenCV: /usr/local (found version "4.1.0") 
------------------------------------------
--Qt: VERSION 4
  QT_INCLUDES: /usr/include/qt4
  QT_LIBRARIES: Qt4::QtCore;Qt4::QtGui;Qt4::QtNetwork;Qt4::QtOpenGL;Qt4::QtSvg;Qt4::QtSql;Qt4::QtXml
  QT_DEFINITIONS: -DHAS_QT
------------------------------------------
--OpenGL:
  OPENGL_INCLUDES: /usr/include
  OPENGL_LIBRARIES: /usr/lib/x86_64-linux-gnu/libGL.so;/usr/lib/x86_64-linux-gnu/libGLU.so
  OPENGL_DEFINITIONS: -DHAS_OPENGL
------------------------------------------
--OpenCV: VERSION 4.1.0
  OPENCV_INCLUDES: /usr/local/include/opencv4
  OPENCV_LIBRARIES: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio
  OPENCV_DEFINITIONS: -DHAS_OPENCV
------------------------------------------
--System:
  SYSTEM_LIBRARIES: pthread;dl
  SYSTEM_DEFINITIONS: -DHAS_SYSTEM
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") 
-- Could NOT find ceres (missing: CERES_LIBRARY CERES_INCLUDE_DIR) 
-- GLOG_LIBRARIES = /usr/lib/x86_64-linux-gnu/libglog.so
-- Could NOT find CHOLMOD (missing: CHOLMOD_INCLUDE_DIR CHOLMOD_LIBRARIES) 
------------------------------------------
--Eigen3: VERSION 3.3.7
  EIGEN3_INCLUDES: /usr/include/eigen3
  EIGEN3_DEFINITIONS: -DHAS_EIGEN3
------------------------------------------
--Ceres:
------------------------------------------
--GLOG:
  GLOG_INCLUDES: /usr/include
  GLOG_LIBRARIES: /usr/lib/x86_64-linux-gnu/libglog.so
  GLOG_DEFINITIONS: -DHAS_GLOG
------------------------------------------
--Cholmod:
gslam_optimizer aborded since can't find dependency Ceres.
-- The following targets will to be build:
-- LIBS():  libgslam_estimator.so; libgslamDB_euroc.so; libgslamDB_kitti.so; libgslamDB_npudronemap.so; libgslamDB_npurgbd.so; libgslamDB_cvmono.so; libgslamDB_rtm.so; libgslamDB_tummono.so; libgslamDB_tumrgbd.so
-- APPS():  gslam
-- C++ flags (Release):  -std=c++11 -O3 -DNDEBUG
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nick/Code/gslam/GSLAM/build

Sorry the opencv version are too high.

Thanks - got it working by pointing cmake to opencv 3.2.0

Hi, i'm facing the same issue. I've install the opencv 3.20 but how to pointing cmake to opencv 3.2.0?