VisionLabs / torch-opencv

OpenCV bindings for Torch.
MIT License
209 stars 48 forks source link

Compile error for ximgproc module (was #95) #103

Open aurotripathy opened 8 years ago

aurotripathy commented 8 years ago

Hi All, Sorry to reopen this. It was #95 (which was closed). I've read the comments (in #95) carefully but have not been successful with "luarocks install cv" yet. Environment is Mac OS, 10.11.1 (El Capitan). My steps,

brew update
brew reinstall opencv3 --with-contrib #took a while
  ---rebuilt torch but not dependencies---
OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV luarocks install cv

Same build error as #95

[ 91%] Building CXX object CMakeFiles/ximgproc.dir/src/ximgproc.cpp.o
In file included from /tmp/luarocks_cv-scm-1-2367/torch-opencv/src/ximgproc.cpp:1:
/tmp/luarocks_cv-scm-1-2367/torch-opencv/include/ximgproc.hpp:49:12: error: no type named 'SelectiveSearchSegmentationStrategy' in namespace 'cv::ximgproc::segmentation'; did you mean
      'SelectiveSearchSegmentationStrategyPtr'?
    inline cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy * operator->() { return static_cast<cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy *>(ptr); }
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           SelectiveSearchSegmentationStrategyPtr
/tmp/luarocks_cv-scm-1-2367/torch-opencv/include/ximgproc.hpp:46:8: note: 'SelectiveSearchSegmentationStrategyPtr' declared here
struct SelectiveSearchSegmentationStrategyPtr {
       ^
/tmp/luarocks_cv-scm-1-2367/torch-opencv/include/ximgproc.hpp:50:12: error: no type named 'SelectiveSearchSegmentationStrategy' in namespace 'cv::ximgproc::segmentation'; did you mean
      'SelectiveSearchSegmentationStrategyPtr'?
shrubb commented 8 years ago

Hi, and sorry for late answer. Thanks for reporting.

This has become a common problem for OS X users, I've finally found out that Homebrew installs a version of contrib from Dec 18, 2015, while that SelectiveSearchSegmentationStrategy is from 2016. I'll now disable the bindings for it, then please try OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV luarocks install cv again.

shrubb commented 8 years ago

To do:

Check at compile time that

CV_VERSION_MAJOR == 3 && CV_VERSION_MINOR >= 1 && strequal(CV_VERSION_STATUS, "-dev")

(I don't yet know how to compare strings at that point), and insert such new features if and only if the above is true.

shrubb commented 8 years ago

@aurotripathy Does it compile now?

aurotripathy commented 8 years ago

@shrubb, Thank you for taking a look and trying to resolve this. Here's what I did.

rm -rf torch-opencv
git clone https://github.com/VisionLabs/torch-opencv.git
source ~/.profile
OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV luarocks install cv

Same error.

If I remove ximgproc from the makery (from CMakeLists.txt, as someone else had suggested), the build is good.

Do I have to start form the top and reinstall opencv3? (i,e., do this step as well, brew reinstall opencv3 --with-contrib )

shrubb commented 8 years ago

@aurotripathy Oh, I forgot a couple of lines in that fix... I'm very sorry to have no OS X PC to test on. It should (hopefully...) work now.

aurotripathy commented 8 years ago

Thanks. I see your handicap (no OS X). Same error. I repeated the step I did before.

rm -rf torch-opencv
git clone https://github.com/VisionLabs/torch-opencv.git
source ~/.profile
OpenCV_DIR=/usr/local/Cellar/opencv3/3.1.0_1/share/OpenCV luarocks install cv
shrubb commented 8 years ago

@aurotripathy OK, so if that doesn't work after the above commit, I should probably consider quitting programming...

aurotripathy commented 8 years ago

Don't quit yet. Looks like all you need is a OS X platform. I installed the latest opencv3, version 3.1.0_2. The error is the same as above. I have a workaround. I'm not blocked.

shrubb commented 8 years ago

:( Sorry again. I'll test it again as soon as I find an OS X PC.