feichtenhofer / gpu_flow

GPU based optical flow extraction in OpenCV
427 stars 109 forks source link

OpenCV3 Make #1

Open blgnksy opened 7 years ago

blgnksy commented 7 years ago

Hi,

My computer's setup is Ubuntu 14.04, Cuda 8, CuDNN 5 and OpenCV 3.2.0. I faced a problem while compiling compute_flow.cpp. I think after OpenCv 2.4 the gpu module had been changed to cuda module. Is there any way to compensate this issue?

Thanks.

pfabreu commented 6 years ago

I have the same issue and it's a bit annoying.

jkuh626 commented 5 years ago

+1

blgnksy commented 5 years ago

@pedro-abreu @jkuh626 You should change the source code and adapt to new OpenCv versions.

KT27-A commented 5 years ago

@blgnksy But how to adapt this to a new version, man?

blgnksy commented 5 years ago

@Katou2 First install the opencv. If you install a newer version than the original gpu_flow used, than search the opencv api documentation and change the includes and method names. You will see class and method prototypes have been changed.

KT27-A commented 5 years ago

@blgnksy Ok, Thanks a lot, man.

KT27-A commented 5 years ago

@blgnksy Hi, man, sorry to bother you again. I've installed opencv 3.4.3 and remake the repository again. I got such problems:

CMakeFiles/compute_flow.dir/compute_flow.o: In function main': /home/katou2/github-home/gpu_flow/compute_flow.cpp:171: undefined reference tocv::gpu::setDevice(int)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:175: undefined reference to cv::gpu::getDevice()' /home/katou2/github-home/gpu_flow/compute_flow.cpp:175: undefined reference tocv::gpu::printShortCudaDeviceInfo(int)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:179: undefined reference to cv::gpu::OpticalFlowDual_TVL1_GPU::OpticalFlowDual_TVL1_GPU()' /home/katou2/github-home/gpu_flow/compute_flow.cpp:354: undefined reference tocv::gpu::GpuMat::upload(cv::Mat const&)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:355: undefined reference to cv::gpu::GpuMat::upload(cv::Mat const&)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:356: undefined reference tocv::gpu::OpticalFlowDual_TVL1_GPU::operator()(cv::gpu::GpuMat const&, cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::gpu::GpuMat&)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:359: undefined reference to cv::gpu::GpuMat::download(cv::Mat&) const' /home/katou2/github-home/gpu_flow/compute_flow.cpp:360: undefined reference tocv::gpu::GpuMat::download(cv::Mat&) const' /home/katou2/github-home/gpu_flow/compute_flow.cpp:350: undefined reference to cv::gpu::GpuMat::upload(cv::Mat const&)' /home/katou2/github-home/gpu_flow/compute_flow.cpp:351: undefined reference tocv::gpu::GpuMat::upload(cv::Mat const&)' CMakeFiles/compute_flow.dir/compute_flow.o: In function main': /usr/include/opencv2/gpu/gpu.hpp:1742: undefined reference tocv::gpu::Stream::Null()' CMakeFiles/compute_flow.dir/compute_flow.o: In function main': /home/katou2/github-home/gpu_flow/compute_flow.cpp:352: undefined reference tocv::gpu::BroxOpticalFlow::operator()(cv::gpu::GpuMat const&, cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::gpu::GpuMat&, cv::gpu::Stream&)' CMakeFiles/compute_flow.dir/compute_flow.o: In function cv::gpu::GpuMat::~GpuMat()': /usr/include/opencv2/core/gpumat.hpp:374: undefined reference tocv::gpu::GpuMat::release()' /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to cv::gpu::GpuMat::release()' /usr/include/opencv2/core/gpumat.hpp:374: undefined reference tocv::gpu::GpuMat::release()' /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to cv::gpu::GpuMat::release()' /usr/include/opencv2/core/gpumat.hpp:374: undefined reference tocv::gpu::GpuMat::release()' CMakeFiles/compute_flow.dir/compute_flow.o:/usr/include/opencv2/core/gpumat.hpp:374: more undefined references to `cv::gpu::GpuMat::release()' follow collect2: error: ld returned 1 exit status CMakeFiles/compute_flow.dir/build.make:140: recipe for target 'compute_flow' failed make[2]: [compute_flow] Error 1 CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/compute_flow.dir/all' failed make[1]: [CMakeFiles/compute_flow.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

Are these you said prototypes changes? But I cannot find them in opencv documents. Have you met such problems? Thank you very much.

blgnksy commented 5 years ago

Yes, those are the prototypes changes. OpenCv programmers transferred some methods to another class. Whenever I have spare time, I can check and try to inform you. Can you push your codes to github repo?

blgnksy commented 5 years ago

Hi,

You have some not installed dependencies. https://www.learnopencv.com/install-opencv-3-4-4-on-ubuntu-16-04/ https://www.learnopencv.com/install-opencv-3-4-4-on-ubuntu-16-04/ read the page and install the dependencies.

On 23 Jan 2019, at 17:16, Katou2 <notifications@github.com mailto:notifications@github.com> wrote:

@blgnksy https://github.com/blgnksy Thank you very much. That's so kind of you. Now I nearly find all of changes and I found that the two optical flow extraction methods are in the opencv_contrib, but I got stuck by compiling it. Do you know what happens? I searched a long time for the solution.

katou2@katou2:~/Downloads/opencv-3.4.3/build$ cmake -DOPENCV_EXTRA_MODULES_PATH=/home/katou2/Downloads/opencv_contrib/modules /home/katou2/Downloads/opencv-3.4.3/ -- Looking for ccache - not found -- Found ZLIB: /home/katou2/anaconda3/lib/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") -- Found ZLIB: /home/katou2/anaconda3/lib/libz.so (found version "1.2.11") -- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so -- Checking for module 'gstreamer-base-1.0' -- No package 'gstreamer-base-1.0' found -- Checking for module 'gstreamer-video-1.0' -- No package 'gstreamer-video-1.0' found -- Checking for module 'gstreamer-app-1.0' -- No package 'gstreamer-app-1.0' found -- Checking for module 'gstreamer-riff-1.0' -- No package 'gstreamer-riff-1.0' found -- Checking for module 'gstreamer-pbutils-1.0' -- No package 'gstreamer-pbutils-1.0' found -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- Checking for module 'libavresample' -- No package 'libavresample' found -- found Intel IPP (ICV version): 2017.0.3 [2017.0.3] -- at: /home/katou2/Downloads/opencv-3.4.3/build/3rdparty/ippicv/ippicv_lnx -- found Intel IPP IW sources: 2017.0.3 -- at: /home/katou2/Downloads/opencv-3.4.3/build/3rdparty/ippicv/ippiw_lnx -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR) -- A library with BLAS API found. -- A library with LAPACK API found. -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file features2d

cudafeatures2d flann shape highgui ml videoio cudaarithm cudabgsegm js cudastereo dnn videostab python imgcodecs stitching cudawarping core photo cudacodec viz cudaobjdetect ts cudaimgproc cudafilters objdetect cudaoptflow video world calib3d cudev superres java cudalegacy imgproc cudafeatures2d shape stereo img_hash ccalib bgsegm bioinspired reg sfm face dpm fuzzy cvv datasets cudaarithm optflow cudabgsegm line_descriptor cudastereo rgbd videostab cudawarping ovis xobjdetect cudacodec viz cudaobjdetect cudaimgproc cudafilters structured_light cudaoptflow saliency tracking xphoto plot ximgproc freetype aruco cudev phase_unwrapping superres hfs dnn_objdetect matlab cudalegacy surface_matching cnn_3dobj xfeatures2d hdf text CMake Error at cmake/OpenCVModule.cmake:352 (message): Duplicated modules NAMES has been found Call Stack (most recent call first): cmake/OpenCVModule.cmake:370 (_assert_uniqueness) modules/CMakeLists.txt:7 (ocv_glob_modules)

-- Configuring incomplete, errors occurred! See also "/home/katou2/Downloads/opencv-3.4.3/build/CMakeFiles/CMakeOutput.log". See also "/home/katou2/Downloads/opencv-3.4.3/build/CMakeFiles/CMakeError.log".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/feichtenhofer/gpu_flow/issues/1#issuecomment-456816631, or mute the thread https://github.com/notifications/unsubscribe-auth/ALcPkbRwjqEwPxxkL2NJmvBMlx6KGFQeks5vGG6kgaJpZM4M_iy_.

KT27-A commented 5 years ago

@blgnksy Thank you very much, man. Everything has been settled.

blgnksy commented 5 years ago

@Katou2 I didn't meet that problem. But it seems at least of the command line arguments that you passed is wrong. Since the error indicates the 158th line in command_line_parser of the opencv core module. Try to debug the before 136th line in compute_flow.cpp that all of the arguments are in correctly passed. Or remove that part and handle the arguments as declaring variables in compute_flow.cpp to pass that part.

blgnksy commented 5 years ago

@Katou2 How can you overcome that error?

KT27-A commented 5 years ago

@blgnksy I checked the document of Opencv detailedly, I found the keys form in the code is different from the form in the document. When I adapted it to the document, it worked.

blgnksy commented 5 years ago

@Katou2 Good job. I also think that the problem is about the command_line_parser of OpenCV. And I think you should push your new working codes to your repo. So If anyone meets same problem, will use your codes.

KT27-A commented 5 years ago

@blgnksy Yeah, that's it. Thank you very much for your help indeed.

blgnksy commented 5 years ago

@Katou2 No problem. Unfortunately original developers doesn't answer any issue.

KT27-A commented 5 years ago

@blgnksy Hah, it pushes us to fully understand what their code expresses. Not bad.

1803643593 commented 5 years ago

Hi, sorry to bother you,i've got same problem, /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadRGBAStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFIsTiled@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFWriteScanline@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFGetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFScanlineSize@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFReadEncodedTile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadRGBATile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFClose@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFRGBAImageOK@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFOpen@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFSetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TIFFSetWarningHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFSetErrorHandler@LIBTIFF_4.0' could you help me ?Thank you very much.

KT27-A commented 5 years ago

@1803643593 Hello, the prototypes changed a lot between opencv2 and opencv3. I have updated this code to opencv3, if you have interest, just go to https://github.com/Katou2/Optical_Flow_GPU_Opencv3. Hope this can help you.