davidstutz / superpixels-revisited

Library containing 7 state-of-the-art superpixel algorithms with a total of 9 implementations used for evaluation purposes in [1] utilizing an extended version of the Berkeley Segmentation Benchmark.
http://davidstutz.de/projects/superpixelsseeds/
260 stars 71 forks source link

Error while compiling with opencv 3.2 #9

Closed MizantropLoL closed 6 years ago

MizantropLoL commented 7 years ago

Hi. When compiling with opencv 3.2, i have errors as following:

[ 23%] Building CXX object fh_cli/CMakeFiles/fh_cli.dir/main.cpp.o
In file included from /usr/local/include/opencv2/core.hpp:54:0,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from /home/superpixels-revisited/lib_seeds_revised/lib/Tools.h:64,
                 from /home/superpixels-revisited/fh_cli/main.cpp:69:
/usr/local/include/opencv2/core/base.hpp: In function ‘int cv::cv_abs(schar)’:
/usr/local/include/opencv2/core/base.hpp:448:47: error: call of overloaded ‘abs(schar&)’ is ambiguous
 inline int cv_abs(schar x) { return std::abs(x); }
                                               ^
In file included from /home/superpixels-revisited/fh_cli/../lib_fh/misc.h:24:0,
                 from /home/superpixels-revisited/fh_cli/main.cpp:66:
/usr/include/c++/5/cmath:81:3: note: candidate: double std::abs(double)
   abs(double __x)
   ^
/usr/include/c++/5/cmath:87:3: note: candidate: float std::abs(float)
   abs(float __x)
   ^
/usr/include/c++/5/cmath:91:3: note: candidate: long double std::abs(long double)
   abs(long double __x)
   ^
/usr/include/c++/5/cmath:99:5: note: candidate: typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp) [with _Tp = signed char; typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type = double]
     abs(_Tp __x)
     ^
In file included from /usr/include/c++/5/cstdlib:72:0,
                 from /home/superpixels-revisited/fh_cli/../lib_fh/pnmfile.h:24,
                 from /home/superpixels-revisited/fh_cli/main.cpp:67:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /home/superpixels-revisited/fh_cli/main.cpp:66:0:
/home/superpixels-revisited/fh_cli/../lib_fh/misc.h:39:10: note: candidate: T abs(const T&) [with T = signed char]
 inline T abs(const T &x) { return (x > 0 ? x : -x); };
          ^
In file included from /home/superpixels-revisited/fh_cli/../lib_fh/pnmfile.h:24:0,
                 from /home/superpixels-revisited/fh_cli/main.cpp:67:
/usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/5/cstdlib:179:3: note: candidate: __int128 std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^
In file included from /usr/local/include/opencv2/core.hpp:54:0,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from /home/superpixels-revisited/lib_seeds_revised/lib/Tools.h:64,
                 from /home/superpixels-revisited/fh_cli/main.cpp:69:
/usr/local/include/opencv2/core/base.hpp: In function ‘int cv::cv_abs(short int)’:
/usr/local/include/opencv2/core/base.hpp:450:47: error: call of overloaded ‘abs(short int&)’ is ambiguous
 inline int cv_abs(short x) { return std::abs(x); }
                                               ^
In file included from /home/superpixels-revisited/fh_cli/../lib_fh/misc.h:24:0,
                 from /home/superpixels-revisited/fh_cli/main.cpp:66:
/usr/include/c++/5/cmath:81:3: note: candidate: double std::abs(double)
   abs(double __x)
   ^
/usr/include/c++/5/cmath:87:3: note: candidate: float std::abs(float)
   abs(float __x)
   ^
/usr/include/c++/5/cmath:91:3: note: candidate: long double std::abs(long double)
   abs(long double __x)
   ^
/usr/include/c++/5/cmath:99:5: note: candidate: typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp) [with _Tp = short int; typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type = double]
     abs(_Tp __x)
     ^
In file included from /usr/include/c++/5/cstdlib:72:0,
                 from /home/superpixels-revisited/fh_cli/../lib_fh/pnmfile.h:24,
                 from /home/superpixels-revisited/fh_cli/main.cpp:67:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
In file included from /home/superpixels-revisited/fh_cli/main.cpp:66:0:
/home/superpixels-revisited/fh_cli/../lib_fh/misc.h:39:10: note: candidate: T abs(const T&) [with T = short int]
 inline T abs(const T &x) { return (x > 0 ? x : -x); };
          ^
In file included from /home/superpixels-revisited/fh_cli/../lib_fh/pnmfile.h:24:0,
                 from /home/superpixels-revisited/fh_cli/main.cpp:67:
/usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/5/cstdlib:179:3: note: candidate: __int128 std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^
fh_cli/CMakeFiles/fh_cli.dir/build.make:62: ошибка выполнения рецепта для цели «fh_cli/CMakeFiles/fh_cli.dir/main.cpp.o»
make[2]: *** [fh_cli/CMakeFiles/fh_cli.dir/main.cpp.o] Ошибка 1
CMakeFiles/Makefile2:418: ошибка выполнения рецепта для цели «fh_cli/CMakeFiles/fh_cli.dir/all»
make[1]: *** [fh_cli/CMakeFiles/fh_cli.dir/all] Ошибка 2
Makefile:83: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2
davidstutz commented 6 years ago

Yes, these are known issues. Most of the code does not support OpenCV 3 or higher yet. If you are interested in individual algorithms, I recommend building these only. Some of the implementations are not OpenCV-heavy and it might be easier to adjust the corresponding parts.