0

I am trying to calibrate my fisheye camera using the cv::fisheye::calibrate fucntion. However, I get the following error while trying to compile.

`undefined reference to 'cv::fisheye::calibrate(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int> const&, cv::_InputOutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::TermCriteria)'`

I have included the following headers

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"

My CMakeLists contains OpenCV2 and my ROS node is also linked with OpenCV

find_package(OpenCV 2 REQUIRED)

add_executable(cam_features src/main.cpp)
target_link_libraries(cam_features ${catkin_LIBRARIES} ${OpenCV_LIBS} ${Eigen_LIBRARIES})

I am not sure where am I going wrong. Can someone point out the probable mistake? Thanks in advance.

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Surabhi Verma
  • 108
  • 1
  • 2
  • 11
  • You are probably missing a flag in your compilation command. – Jarvis Feb 06 '19 at 08:51
  • calib3d module was compiled? Do you have opencv_calib3d library in opencv/build/lib directory? – Nuzhny Feb 06 '19 at 11:33
  • @Jarvis I just built it by catkin_make – Surabhi Verma Feb 06 '19 at 21:43
  • @Nuzhny I do have the following: `/opencv/build/lib/libopencv_calib3d.so` – Surabhi Verma Feb 06 '19 at 21:44
  • Yes, this library. And opencv includes must be from identical version. It is possible than used includes and libraries from different opencv versions? – Nuzhny Feb 07 '19 at 06:00
  • @Nuzhny Yes, I have two versions of OpenCV. My executable was linked to OpenCV 3.3 (this too has the calib3d functionality in addition to Opencv2 having it) which came with ROS Kinetic. Looks like I just had to get rid of the existing build products (as mentioned in the answer) – Surabhi Verma Feb 07 '19 at 09:26

1 Answers1

0

I got this working by cleaning the build products. Also, I let the package remain to OpenCV rather than OpenCV2.

Surabhi Verma
  • 108
  • 1
  • 2
  • 11