Ask Your Question
0

error buiding cudaoptflow/samples/optical_flow.cpp on current master branch for opencv AND contrib

asked 2020-05-21 13:51:21 -0600

alutfi gravatar image

Hello all.

I am trying to get yolov4 to work with CUDA on ubuntu, so I cloned from the master branches of both opencv and opencv_contrib, as I see the support for mish activation function was already implemented.

However, I am getting the following build error:

/home/antonio/installers/opencv_contrib_2020_05_21/modules/cudaoptflow/samples/optical_flow.cpp:185:101: error: cannot bind non-const lvalue reference of type ‘cv::cuda::Stream&’ to an rvalue of type ‘cv::cuda::Stream’ NvidiaOpticalFlow_1_0::NVIDIA_OF_PERF_LEVEL::NV_OF_PERF_LEVEL_FAST, false, false, false, 0, Stream(), Stream()); ^~~~~~~~

In file included from /home/antonio/installers/opencv_contrib_2020_05_21/modules/cudaoptflow/samples/optical_flow.cpp:7:0: /home/antonio/installers/opencv_contrib_2020_05_21/modules/cudaoptflow/include/opencv2/cudaoptflow.hpp:447:47: note: initializing argument 8 of ‘static cv::Ptr<cv::cuda::nvidiaopticalflow_1_0> cv::cuda::NvidiaOpticalFlow_1_0::create(int, int, cv::cuda::NvidiaOpticalFlow_1_0::NVIDIA_OF_PERF_LEVEL, bool, bool, bool, int, cv::cuda::Stream&, cv::cuda::Stream&)’ CV_WRAP static Ptr<nvidiaopticalflow_1_0> create( ^~~~~~ modules/cudaoptflow/CMakeFiles/example_cudaoptflow_optical_flow.dir/build.make:65: recipe for target 'modules/cudaoptflow/CMakeFiles/example_cudaoptflow_optical_flow.dir/samples/optical_flow.cpp.o' failed

Can you please help me understand what's going on? Since it seems like a syntax error, I am thinking that I either have to clone opencv_contrib from a different place than master, or that this is an actual bug on the code.

Thanks a lot for your time and help!

Antonio

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-05-22 05:22:40 -0600

I can compile on windows without any problems as Visual Studio doesn't have an issue with creating a temporary object and then passing by reference, however I suspect you need to chane

Ptr<cuda::NvidiaOpticalFlow_1_0> nvof = cuda::NvidiaOpticalFlow_1_0::create(frame0.size().width, frame0.size().height,
    NvidiaOpticalFlow_1_0::NVIDIA_OF_PERF_LEVEL::NV_OF_PERF_LEVEL_FAST, false, false, false, 0, Stream(), Stream());

to

Ptr<cuda::NvidiaOpticalFlow_1_0> nvof = cuda::NvidiaOpticalFlow_1_0::create(frame0.size().width, frame0.size().height,
    NvidiaOpticalFlow_1_0::NVIDIA_OF_PERF_LEVEL::NV_OF_PERF_LEVEL_FAST, false, false, false, 0, Stream::Null(), Stream::Null());

to get it to compile with gcc.

edit flag offensive delete link more

Comments

Can verify setting to Stream::Null() worked! (go to the opencv_contrib/module/cudaoptflow/samples/opticalflow.cpp and change line 184/185)

more info un Stream::Null(): https://docs.opencv.org/master/d9/df3...

geraltofrivias gravatar imagegeraltofrivias ( 2020-05-22 21:06:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-05-21 13:51:21 -0600

Seen: 594 times

Last updated: May 22 '20