code-iai / iai_kinect2

Tools for using the Kinect One (Kinect v2) in ROS
Apache License 2.0
879 stars 520 forks source link

iai_kinect2 make error: kinect2_calibration.cpp error: cannot convert 'const cv::TermCriteria' to 'int' #461

Open kaisark opened 6 years ago

kaisark commented 6 years ago

I am running into a compile time error making iai_kinect2 under ROS. I have installed freenect2 and am able to run Protonect successfully. Is this an opencv version error? I have built opencv 3.3 from source and am running ROS Kinetic on ubuntu 16 (jetson tx1).

nvidia@tegra-ubuntu:~/jetsonbot$ catkin_make
Base path: /home/nvidia/jetsonbot Source space: /home/nvidia/jetsonbot/src Build space: /home/nvidia/jetsonbot/build Devel space: /home/nvidia/jetsonbot/devel Install space: /home/nvidia/jetsonbot/install

Running command: "make cmake_check_build_system" in "/home/nvidia/jetsonbot/build"

Running command: "make" in "/home/nvidia/jetsonbot/build"

[ 11%] Building CXX object iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/src/kinect2_calibration.cpp.o [ 44%] Built target depth_registration [ 55%] Building CXX object iai_kinect2/registration_viewer/CMakeFiles/viewer.dir/src/viewer.cpp.o [ 66%] Building CXX object iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp: In constructor 'Recorder::Recorder(const string&, const string&, const string&, Source, bool, bool, const Size&, float, float)': /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:98:14: warning: 'Recorder::maxIr' will be initialized after [-Wreorder] int minIr, maxIr; ^ /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:89:9: warning: 'float Recorder::auto_saving_interval' [-Wreorder] float auto_saving_interval; // minimum interval between two savings ^ /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:101:3: warning: when initialized here [-Wreorder] Recorder(const std::string &path, const std::string &topicColor, const std::string &topicIr, const Source mode, const bool circleBoard, const bool symmetric, const cv::Size &boardDims, const float boardSize, const float autoSavingInterval) ^ /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp: In member function 'void Calibrator::calibrateExtrinsics()': /home/nvidia/jetsonbot/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:679:56: error: cannot convert 'const cv::TermCriteria' to 'int' for argument '13' to 'double cv::stereoCalibrate(cv::InputArrayOfArrays, cv::InputArrayOfArrays, cv::InputArrayOfArrays, cv::InputOutputArray, cv::InputOutputArray, cv::InputOutputArray, cv::InputOutputArray, cv::Size, cv::OutputArray, cv::OutputArray, cv::OutputArray, cv::OutputArray, int, cv::TermCriteria)' cv::CALIB_FIX_INTRINSIC); ^ iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/build.make:62: recipe for target 'iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/src/kinect2_calibration.cpp.o' failed make[2]: [iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/src/kinect2_calibration.cpp.o] Error 1 CMakeFiles/Makefile2:1676: recipe for target 'iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/all' failed make[1]: [iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

suijingfeng commented 6 years ago

try sudo apt-get install ros-kinetic-opencv3?

kaisark commented 6 years ago

Update: 1/4 start I installed a few ROS packages and removed the PCL 1.8, instead relying on ros-pcl: sudo apt-get install ros-kinetic-rgbd-launch sudo apt-get install ros-kinetic-openni2-camera sudo apt-get install ros-kinetic-openni2-launch sudo apt-get install ros-kinetic-rqt ros-kinetic-rqt-common-plugins ros-kinetic-rqt-robot-plugins

The following also works: Open a terminal (Ctrl+Alt+t): roscore Open a terminal (Ctrl+Alt+t): roslaunch openni2_launch openni2.launch Open a terminal (Ctrl+Alt+t): rqt

I have attached the screenshot of rqt. ros-rqt1

Update: 1/4 end

I have built opencv '3.3.1' from source and it looks like ros-kinetic-opencv3 is also installed (see below). I have installed OpenNi2 and NiViewer2 is working. I have also built PCL 1.8 from source and pcl_openni2_viewer is also working.

I heard Microsoft killed off the Kinect adapter (essentially the Kinect Sensor) today, but I wanted to test out a few point cloud apps (e.g. robotics use cases).

Has anyone tried to get the iai_kinect2 working on ros kinetic jetson (ubuntu 16) tx1 using openni2??? Do I need to pull a specific branch?

nvidia@tegra-ubuntu:~/jetsonbot$ sudo apt-get install ros-kinetic-opencv3
Reading package lists... Done Building dependency tree
Reading state information... Done ros-kinetic-opencv3 is already the newest version (3.3.1-0xenial-20171107-211027-0800). ros-kinetic-opencv3 set to manually installed. The following packages were automatically installed and are no longer required: apt-clone archdetect-deb containerd dmeventd dpkg-repack firefox-locale-en gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 libappstream3 libdebian-installer4 libdevmapper-event1.02.1 liblept5 liblockfile-bin liblockfile1 liblvm2app2.2 liblvm2cmd2.02 libmircommon5 libopenni-dev libproj-dev libreadline5 libtesseract3 libuv1 libvtk-java libvtk5.10 lockfile-progs lvm2 os-prober phonon-backend-gstreamer-common pmount python3-icu python3-pam rdate ros-kinetic-pcl-msgs ros-kinetic-tf2-eigen runc tesseract-ocr-eng tesseract-ocr-equ tesseract-ocr-osd ubiquity-casper ubiquity-ubuntu-artwork ubuntu-fan Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 383 not upgraded.

suijingfeng commented 6 years ago

@kaisark although you have opencv3 installed, but you program seem not link it properly. the following picture is a snap shot for my kinect2_calibration.cpp files, issue2 combine this picture with the log you provide, what we can infer is that you iai_kinect2 kinect2_calibration module trying to link opencv2, only if CV_MAJOR_VERSION == 2 will cause you issues. as the last two parameter of stereoCalibrate function is different between opencv2 and opencv3.

I don't know why you iai_kinect2 package trying to link opencv2, possible solutions are:

  1. update the iai_kinect2 to the latest, code downloaded before Dec 10, 2015 only support opencv2, see this link

  2. if you have installed opencv2 previously, try to remove it. you can also force kinect2_calibration link opencv3 by change kinect2_calibration/CMakeLists.txt with find_package(OpenCV 3.3.1 REQUIRED).