Adapt SVO-edgelet to OpenCV 3.4

Posted by Chen Jinyu on February 13, 2020

The original SVO cannot been used for live camera.(It’s too difficult to rearrange its code for live camera with plain cmake, and with ROS the program always crashed.)

So we choose the improved version svo_edgelet. But it is base on OpenCV 2.4.X, when using OpenCV 3.4.X the compiling error occurs. We don’t considered using OpenCV 2.4.X as a good solution, so we make some changes to the code to adapt it to OpenCV 3.4.X.

We need to modify the following four places.

  1. In feature_detection.cpp line28, change cv::format(data,"CSV") to cv::format(data,cv::Formatter::FMT_CSV), according to this qiita page.

  2. In precomp.hpp line52, delete#include "opencv2/core/internal.hpp" and add #include "opencv2/opencv.hpp".

  3. In five-point.cpp, there is outdated using of transforming CvMat* to Mat. Change all the cv::Mat(CvMat*) format into cv::cvarrToMat(CvMat*), according to this stackoverflow page or this csdn blog.

  4. In modelest.cpp line191, according to this stackoverflow page. The CV_IMPLEMENT_QSORT function is out of date, so we can change it into

static void icvSortDistances(int *array, size_t total, int)
{
    std::sort(&array[0], &array[total]);
}

Also you can directly git clone https://github.com/feketerigo96/feketerigo96.github.io.git