Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dense_flow Compile Error ->opencv2/xfeatures2d.hpp #15

Closed
yangyuke001 opened this issue Jun 27, 2019 · 12 comments
Closed

dense_flow Compile Error ->opencv2/xfeatures2d.hpp #15

yangyuke001 opened this issue Jun 27, 2019 · 12 comments

Comments

@yangyuke001
Copy link

my environment:ubuntu16.04,opencv3.4.0

the error log as blew:
/dense_flow/build$ cmake .. && make -j
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yyk/ACTION/mmaction/third_party/dense_flow/build
Scanning dependencies of target denseflow
[ 7%] Building CXX object CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o
[ 14%] Building CXX object CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o
/home/yyk/ACTION/mmaction/third_party/dense_flow/src/dense_warp_flow_gpu.cpp:12:10: fatal error: opencv2/xfeatures2d.hpp: No such file or directory
#include "opencv2/xfeatures2d.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
/home/yyk/ACTION/mmaction/third_party/dense_flow/src/dense_flow_gpu.cpp:5:10: fatal error: opencv2/xfeatures2d.hpp: No such file or directory
#include "opencv2/xfeatures2d.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/denseflow.dir/build.make:134: recipe for target 'CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseflow.dir/src/dense_warp_flow_gpu.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/denseflow.dir/build.make:110: recipe for target 'CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseflow.dir/src/dense_flow_gpu.cpp.o] Error 1
CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/denseflow.dir/all' failed
make[1]: *** [CMakeFiles/denseflow.dir/all] Error 2

thanks in advance!

@yangyuke001
Copy link
Author

@zhaoyue-zephyrus sorry for trouble you

@zhaoyue-zephyrus
Copy link
Collaborator

zhaoyue-zephyrus commented Jun 27, 2019

Hi, @yangyuke001

How do you install your opencv 3.4.0? xfeatures2d is in opencv_contrib. You probably have to build your opencv with this extra module by explicitly setting -DOPENCV_EXTRA_MODULES_PATH=/PATH/TO/YOUR/OPENCV_CONTRIB/.

Please refer to issue #9 for compiling dense_flow with opencv 4.1.0. Compiling with opencv 3.x should be similar. Also as a reminder, please check out the branch property.

@yangyuke001
Copy link
Author

@zhaoyue-zephyrus Thanks for your reply,I will try it now.

@yangyuke001
Copy link
Author

Another error happened ,some of the errors log like :

dense_warp_flow_gpu.cpp:(.text+0x251a):对‘cv::cuda::BroxOpticalFlow::create(double, double, double, int, int, int)’未定义的引用
dense_warp_flow_gpu.cpp:(.text+0x2de0):对‘cv::cuda::split(cv::_InputArray const&, cv::cuda::GpuMat*, cv::cuda::Stream&)’未定义的引用
dense_warp_flow_gpu.cpp:(.text+0x377a):对‘cv::cuda::split(cv::_InputArray const&, cv::cuda::GpuMat*, cv::cuda::Stream&)’未定义的引用

my envirenment:Ubuntu 16.04 + CUDA 10.1,and I download NVIDIA VIDEO CODEC SDK and copy the two header files to cuda path .

@zhaoyue-zephyrus
Copy link
Collaborator

@yangyuke001

Are you enabling CUDA when install opencv?

@yangyuke001
Copy link
Author

yangyuke001 commented Jun 27, 2019

@zhaoyue-zephyrus
yes -> -DWITH_CUDA=ON
and there is no error when build opencv-4.1.0

And I cloned the lasted dense_flow codebase supports opencv4.1.0

@zhaoyue-zephyrus
Copy link
Collaborator

zhaoyue-zephyrus commented Jun 27, 2019

@yangyuke001
What about explicitly specifying the opencv 4.1.0's path by OpenCV_DIR=/PATH/TO/OPENCV4/build/ cmake ..? Maybe you have various opencvs on your machine.

@yangyuke001
Copy link
Author

yangyuke001 commented Jun 27, 2019

@zhaoyue-zephyrus
1.
OpenCV_DIR=../../../third_party/opencv-4.1.0/build
2.
when cmake,some of the log:
......
-- Found CUDA: /usr/local/cuda (found suitable exact version "10.1")
-- Found OpenCV: /usr/local (found version "3.4.0")
......
3.make -j
......
fatal error: opencv2/xfeatures2d.hpp: No such file or directory
......

heart-broken

@zhaoyue-zephyrus
Copy link
Collaborator

@yangyuke001
Well, this makes sense. The log is telling you that you are using some other OpenCV (i.e. 3.4.0) which possibly wasn't built with CUDA. To avoid this, you have to delete the cache produced by previous cmake. The safest thing is to rm -r build/ and build again. Would you like to have another try? Also, you can see if the OpenCV is set correct (should be "4.1.0") by watching the cmake's log.

@yangyuke001
Copy link
Author

yangyuke001 commented Jun 27, 2019

@zhaoyue-zephyrus
It's almost done.
But there are some tiny mistake,such as,

in dense_flow.cpp and other .cpp files:
CV_BGR2GRAY should be replaced by COLOR_BGR2GRAY

in dense_flow.cpp :

  • cv::Ptrcv::optflow::DualTVL1OpticalFlow alg_tvl1 = cv::optflow::DualTVL1OpticalFlow::create();
  • cv::Ptrcv::superres::DualTVL1OpticalFlow alg_tvl1 = cv::superres::createOptFlow_DualTVL1();

@zhaoyue-zephyrus
Copy link
Collaborator

@yangyuke001 Good to hear that:)

Actually what you mentioned have been merged into the master branch. (Check it out at https://github.com/yjxiong/dense_flow/blob/master/src/dense_flow_gpu.cpp#L32 for example)

I will update the submodule and the related workaround quickly.

@yangyuke001
Copy link
Author

@zhaoyue-zephyrus
Awesome !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants