Coder Social home page Coder Social logo

dense_flow's People

Contributors

wanglimin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dense_flow's Issues

camke and make -j are completed,but when i test the command like this,some mistake happened

The opencv-3.1.0 and its contrib is installed.then I am going to install dense_flow.
everything looks ok,but when I input the command below
./extract_gpu -f=test.avi -x=tmp/flow_x -y=tmp/flow_y -i=tmp/image -b=20 -t=1 -d=0 -s=1 -o=dir

then I get
OpenCV Error: Gpu API call (no kernel image is available for execution on the device) in call, file /home/yh/opencv-3.1.0/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp, line 318
terminate called after throwing an instance of 'cv::Exception'
what(): /home/yh/opencv-3.1.0/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp:318: error: (-217) no kernel image is available for execution on the device in function call

how can I solve this problem? Thx a lot!!!

Could NOT find LIBZIP

image
How to solve this problem?
I have Installed LIBZIP use yum install libzip, the version is libzip-0.10.1-8.el7.x86_64.

cmd run dense_flow.exe error

Hi, thanks for your first.

After using cmake to build a solution and using Visual Studio 2015 to build a dense_flow.exe, when I use cmd to run the dense_flow.exe, it crushes as this:

112

Could you please help me?

bash: ./denseFlow_gpu: No such file or directory

hi,i don't know how to run the code,
i have cmake the CMakeLists.txt and make it
$ cmake CMakeLists.txt

$ make

then,i run the cmd:
$ ./denseFlow_gpu -f test.avi -x tmp/flow_x -y tmp/flow_x -i tmp/image -b 20 -t 1 -d 0 -s 1
bash: ./denseFlow_gpu: No such file or directory

could u plz tell me how to fix it?

how do you set the parameter s?

I read some papers of you and noticed that you didn't mention the parameter step.
Could please tell me how do you select this parameter and would this have a big influence on the result?

optical flow using brox algorithm

Hi, I would like to know what algorithm is using in optical flow ,is this Brox algorithm?? I am searching for optical flow to fit in my model~~
Thanks for your attention~

CMakeFiles/extract_cpu.dir/build.make:120: recipe for target 'extract_cpu' failed

[ 71%] Linking CXX executable extract_warp_gpu
/usr/bin/ld: cannot find -lopencv_dep_cudart
/usr/bin/ld: cannot find -lopencv_dep_nppial
/usr/bin/ld: cannot find -lopencv_dep_nppicc
/usr/bin/ld: cannot find -lopencv_dep_nppicom
/usr/bin/ld: cannot find -lopencv_dep_nppidei
/usr/bin/ld: cannot find -lopencv_dep_nppif
/usr/bin/ld: cannot find -lopencv_dep_nppig
/usr/bin/ld: cannot find -lopencv_dep_nppim
/usr/bin/ld: cannot find -lopencv_dep_nppist
/usr/bin/ld: cannot find -lopencv_dep_nppisu
/usr/bin/ld: cannot find -lopencv_dep_nppitc
collect2: error: ld returned 1 exit status
CMakeFiles/extract_cpu.dir/build.make:120: recipe for target 'extract_cpu' failed
make[2]: *** [extract_cpu] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/extract_cpu.dir/all' failed

Hi, when I use the cammand make -j, it shows a problem like this ! Can anyone give me some suggestions? Thanks!

Different frame num with original video

Hi,

I found that for some videos, the frame number of extracted optical flow is different from the number of original video counted by video.get(cv2.CAP_PROP_FRAME_COUNT).

Any thoughts on this? @wanglimin

I couldn't find frames

Hello,When I am running ./denseImage,everything is ok until executing the code "capture>>frame",it looks like that there is no frame and then break.By the way ,test.avi could be open correctly.Somebody could help me?

Errors make denseFlow_gpu

After make I get the following errors:

/usr/include/opencv2/gpu/gpu.hpp:432:29: error 'vector' does not name a type

/denseFlow_gpu.cpp: In function 'int main(int, char**)':
/denseFlow_gpu.cpp:51:2: error: 'string' was not declared in this scope

/denseFlow_gpu.cpp:60:23: error: ‘vidFile’ was not declared in this scope

CMakeFiles/denseFlow_gpu.dir/build.make:54: recipe for target 'CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/denseFlow_gpu.dir/all' failed
make[1]: *** [CMakeFiles/denseFlow_gpu.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

denseFlow_GPU with OpenCV 3.4.6

Install the OpenCV with CUDA and use the following code to get optical flow

#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/cuda.hpp"
#include "opencv2/cudaoptflow.hpp"
#include "opencv2/cudaarithm.hpp"

#include <stdio.h>
#include <string>
#include <iostream>

using namespace std;
using namespace cv;
using namespace cv::cuda;

static void convertFlowToImage(const Mat &flow_x, const Mat &flow_y, Mat &img_x, Mat &img_y,
       double lowerBound, double higherBound) {
	#define CAST(v, L, H) ((v) > (H) ? 255 : (v) < (L) ? 0 : cvRound(255*((v) - (L))/((H)-(L))))
	for (int i = 0; i < flow_x.rows; ++i) {
		for (int j = 0; j < flow_y.cols; ++j) {
			float x = flow_x.at<float>(i,j);
			float y = flow_y.at<float>(i,j);
			img_x.at<uchar>(i,j) = CAST(x, lowerBound, higherBound);
			img_y.at<uchar>(i,j) = CAST(y, lowerBound, higherBound);
		}
	}
	#undef CAST
}

static void drawOptFlowMap(const Mat& flow, Mat& cflowmap, int step,double, const Scalar& color){
    for(int y = 0; y < cflowmap.rows; y += step)
        for(int x = 0; x < cflowmap.cols; x += step)
        {
            const Point2f& fxy = flow.at<Point2f>(y, x);
            line(cflowmap, Point(x,y), Point(cvRound(x+fxy.x), cvRound(y+fxy.y)),
                 color);
            circle(cflowmap, Point(x,y), 2, color, -1);
        }
}

int main(int argc, char** argv){
	// IO operation
	//const char* keys =
//     		{
// 			"{ f  | vidFile      | ex2.avi | filename of video }"
// 			"{ x  | xFlowFile    | flow_x | filename of flow x component }"
// 			"{ y  | yFlowFile    | flow_y | filename of flow x component }"
// 			"{ i  | imgFile      | flow_i | filename of flow image}"
// 			"{ b  | bound | 15 | specify the maximum of optical flow}"
// 			"{ t  | type | 0 | specify the optical flow algorithm }"
// 			"{ d  | device_id    | 0  | set gpu id}"
// 			"{ s  | step  | 1 | specify the step for frame sampling}"
// 		};
    
  const cv::String keys =
      "{@vidFile     | | filename of video }"
      "{@xFlowFile   | | filename of flow x component }"
      "{@yFlowFile   | | filename of flow x component }"
      "{@imgFile     | | filename of image component }"
      "{@bound       | 15 | specify the maximum of optical flow}"
      "{@type        | 0 | specify the optical flow algorithm }"
      "{@device_id   | 0 | set gpu id }"
      "{@step        | 1 | specify the step for frame sampling}"
      ;

    
	cv::CommandLineParser cmd(argc, argv, keys);
	std::string vidFile = cmd.get<string>("@vidFile");
	std::string xFlowFile = cmd.get<string>("@xFlowFile");
	std::string yFlowFile = cmd.get<string>("@yFlowFile");
	std::string imgFile = cmd.get<string>("@imgFile");
	int bound = cmd.get<int>("@bound");
    int type  = cmd.get<int>("@type");
    int device_id = cmd.get<int>("@device_id");
    int step = cmd.get<int>("@step");
    
	cv::VideoCapture capture(vidFile);
	if(!capture.isOpened()) {
		printf("Could not initialize capturing..\n");
		return -1;
	}

	int frame_num = 0;
	Mat image, prev_image, prev_grey, grey, frame, flow, flows[2];
	GpuMat frame_0, frame_1, gflow;

	setDevice(device_id);
    cv::Ptr<cv::cuda::FarnebackOpticalFlow> alg_farn;
	cv::Ptr<cv::cuda::OpticalFlowDual_TVL1> alg_tvl1;
	cv::Ptr<cv::cuda::BroxOpticalFlow> alg_brox;

	while(true) {
		capture >> frame;
		if(frame.empty())
			break;
		if(frame_num == 0) {
			image.create(frame.size(), CV_8UC3);
			grey.create(frame.size(), CV_8UC1);
			prev_image.create(frame.size(), CV_8UC3);
			prev_grey.create(frame.size(), CV_8UC1);

			frame.copyTo(prev_image);
			cvtColor(prev_image, prev_grey, CV_BGR2GRAY);

			frame_num++;

			int step_t = step;
			while (step_t > 1){
				capture >> frame;
				step_t--;
			}
			continue;
		}

		frame.copyTo(image);
		cvtColor(image, grey, CV_BGR2GRAY);
        
		frame_0.upload(prev_grey);
		frame_1.upload(grey);

        // GPU optical flow
		switch(type){
		case 0:
            alg_farn = cv::cuda::FarnebackOpticalFlow::create();
			alg_farn->calc(frame_0,frame_1, gflow);
			break;
		case 1:
            alg_tvl1 = cv::cuda::OpticalFlowDual_TVL1::create();
			alg_tvl1->calc(frame_0,frame_1, gflow);
			break;
		case 2:
            alg_brox = cv::cuda::BroxOpticalFlow::create(0.197f, 50.0f, 0.8f, 10, 77, 10);
			GpuMat d_frame0f, d_frame1f;
	        frame_0.convertTo(d_frame0f, CV_32F, 1.0 / 255.0);
	        frame_1.convertTo(d_frame1f, CV_32F, 1.0 / 255.0);
			alg_brox->calc(d_frame0f, d_frame1f, gflow);
			break;
		}

		gflow.download(flow);
		cv::split(flow, flows);

		// Output optical flow
		Mat imgX(flows[0].size(),CV_8UC1);
		Mat imgY(flows[1].size(),CV_8UC1);
		convertFlowToImage(flows[0],flows[1], imgX, imgY, -bound, bound);
		char tmp[20];
		sprintf(tmp,"_%05d.jpg",int(frame_num));

		// Mat imgX_, imgY_, image_;
		// resize(imgX,imgX_,cv::Size(340,256));
		// resize(imgY,imgY_,cv::Size(340,256));
		// resize(image,image_,cv::Size(340,256));

		imwrite(xFlowFile + tmp,imgX);
		imwrite(yFlowFile + tmp,imgY);
		imwrite(imgFile + tmp, image);
        
		std::swap(prev_grey, grey);
		std::swap(prev_image, image);
		frame_num = frame_num + 1;

		int step_t = step;
		while (step_t > 1){
			capture >> frame;
			step_t--;
		}
	}
	return 0;
}

The command I use is :

./denseFlow_gpu --vidFile /home/Datasets/video/UCF-101/TaiChi/v_TaiChi_g25_c04.avi --xFlowFile tmp/flow_x --yFlowFile tmp/flow_x --imgFile tmp/image --bound 20 --type 1 --evice_id 0 --step 1

Here my question is about the command line --xFlowFile tmp/flow_x --yFlowFile tmp/flow_x, why the flow in x/y direction result in the same file?

run error

./extract_gpu -f /home/shawxiao/Two-stream-Network/workspace/dense_flow/videos/test.avi -x /home/shawxiao/Two-stream-Network/workspace/dense_flow/tmp/flow_x -y /home/shawxiao/Two-stream-Network/workspace/dense_flow/tmp/flow_y -i /home/shawxiao/Two-stream-Network/workspace/dense_flow/tmp/image -b 20 -t 1 -d 0 -s 1 -o dir -w 256 -h 256

fatal error: opencv2/gpu/gpu.hpp: No such file or directory

(cv) vinsent_research@instance-group-1-3p16:~/dense_flow$ sudo make
Scanning dependencies of target denseFlow_gpu
[ 50%] Building CXX object CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o
/home/vinsent_research/dense_flow/denseFlow_gpu.cpp:4:31: fatal error: opencv2/gpu/gpu.hpp: No such file or directory
compilation terminated.
CMakeFiles/denseFlow_gpu.dir/build.make:62: recipe for target 'CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o' failed
make[2]: *** [CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/denseFlow_gpu.dir/all' failed
make[1]: *** [CMakeFiles/denseFlow_gpu.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I have installed all the necessary packages by following
https://github.com/VinACE/Install-TensorFlow-OpenCV-GPU-Ubuntu-17.10
my opencv 3.4.1 install in ubutu 18

sudo cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=OFF
-DPYTHON2_EXECUTABLE=/usr/bin/python2
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib-3.4.1/modules
-D PYTHON_EXECUTABLE=
/.virtualenvs/cv/bin/python
-D WITH_CUDA=ON
-D CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-5
-D CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-5
-D BUILD_EXAMPLES=ON ..

questions about the optical flow images.

I used calcOpticalFlowFarneback to extract dense optical flow from a video with the bound 15. I checked the results and found most values of pixels are around 127 or 128. Is it normal?

make error?

hi,dear
I make according with the codes

git clone --recursive http://github.com/yjxiong/dense_flow
mkdir build && cd build
cmake .. && make -j

but then I got mistake

CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/home/xulm1/xulm1/dense_flow/build/CMakeFiles/CMakeOutput.log".


I have installed opencv-python

>>> import cv2
>>> quit()

should I install OpenCV source codes ??
Or how to solve the problem ?
thx

Code for OpenCV >= 3

Code snippet using OpenCV >= 3 version:

        cv::Mat image, prev_image, prev_grey, grey, frame, flow, flows[2];
	cv::cuda::GpuMat frame_0, frame_1, gflow;

	cv::cuda::setDevice(chrDevID);

	cv::Ptr<cv::cuda::OpticalFlowDual_TVL1> alg_tvl1 = cv::cuda::OpticalFlowDual_TVL1::create();
	cv::Ptr<cv::cuda::FarnebackOpticalFlow> alg_farn = cv::cuda::FarnebackOpticalFlow::create();
	cv::Ptr<cv::cuda::BroxOpticalFlow> alg_brox = cv::cuda::BroxOpticalFlow::create();

	while (true) {
		capture >> frame;
		if (frame.empty())
			break;
		if (intFrameNum == 0) {
			image.create(frame.size(), CV_8UC3);
			grey.create(frame.size(), CV_8UC1);
			prev_image.create(frame.size(), CV_8UC3);
			prev_grey.create(frame.size(), CV_8UC1);

			frame.copyTo(prev_image);
			cv::cvtColor(prev_image, prev_grey, cv::COLOR_BGR2GRAY);

			intFrameNum++;

			int intStep_t = intStep;
			while (intStep_t > 1) {
				capture >> frame;
				intStep_t--;
			}
			continue;
		}

		frame.copyTo(image);
		cv::cvtColor(image, grey, cv::COLOR_BGR2GRAY);

		frame_0.upload(prev_grey);
		frame_1.upload(grey);

		// GPU optical flow
		switch (intType) {
		case 0:
			alg_farn->calc(frame_0, frame_1, gflow);
			break;
		case 1:
			alg_tvl1->calc(frame_0, frame_1, gflow);
			break;
		case 2:
			cv::cuda::GpuMat d_frame0f, d_frame1f;
			frame_0.convertTo(d_frame0f, CV_32F, 1.0 / 255.0);
			frame_1.convertTo(d_frame1f, CV_32F, 1.0 / 255.0);
			alg_brox->calc(d_frame0f, d_frame1f, gflow);
			break;
		}

		gflow.download(flow);
		cv::split(flow, flows);

		// Output optical flow
		cv::Mat imgX(flows[0].size(), CV_8UC1);
		cv::Mat imgY(flows[1].size(), CV_8UC1);
		convertFlowToImage(flows[0], flows[1], imgX, imgY, -intBound, intBound);
		char chrSuffix[20];
		sprintf_s(chrSuffix, "_%06d.jpg", int(intFrameNum));

		cv::Mat imgX_, imgY_, image_;
		intHeight = (intHeight > 0) ? intHeight : imgX.rows;
		intWidth = (intWidth  > 0) ? intWidth : imgX.cols;
		resize(imgX, imgX_, cv::Size(intWidth, intHeight));
		resize(imgY, imgY_, cv::Size(intWidth, intHeight));
		resize(image, image_, cv::Size(intWidth, intHeight));

		//cv::namedWindow("image", cv::WINDOW_AUTOSIZE);
		//cv::imshow("image", imgY_);
		//cv::waitKey(20);

		cv::imwrite(strSavePath + strXFlowFile + chrSuffix, imgX_);
		cv::imwrite(strSavePath + strYFlowFile + chrSuffix, imgY_);
		cv::imwrite(strSavePath + strImgFile + chrSuffix, image_);

Gpu API call (invalid device function) in call

I use the tool to get test image from my test.avi, and follow the usage

./denseFlow_gpu -f test.avi -x tmp/flow_x -y tmp/flow_x -i tmp/image -b 20 -t 1 -d 0 -s 1

and get the error

OpenCV Error: Gpu API call (invalid device function) in call, file /home/uuz/Downloads/opencv/Install-OpenCV-master/Ubuntu/2.4/OpenCV/opencv-2.4.10/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 361
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/uuz/Downloads/opencv/Install-OpenCV-master/Ubuntu/2.4/OpenCV/opencv-2.4.10/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp:361: error: (-217) invalid device function in function call

[1]    16872 abort (core dumped)  ./denseFlow_gpu -f test.avi -x tmp/flow_x -y tmp/flow_x -i tmp/image -b 20 -t

after that I add

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch compute_35 -code sm_35)

to the CmakeLists.txt and make again, the error is the same as above, I do not know how to solve it.
Thank you in advance!

why is the TVL1 with GPU so slow?

I ran the algorithm on two GPUs and 8 workers, but the consumed 10 hours for 1000 videos (5~15 seconds duration per video) .
Anyone know why is so slow ?
Thanks.

question about extract optical flow

Hi@wanglimin :

when I run the"cmake CMakeLists.txt"and"make" in linux terminal,The generating execute file is "denseImage",when I execute the "denseImage",only gengerate the RGB file, can not generate flow file,
in the "CMakeLists.txt" file,only include "denseImage.cpp",not include"denseFlow_gpu.cpp",
so I doubt that it need to modify the "CMakeLists.txt",I really appreciate for your reply.

Thanks in advance!

Gpu API call (unknown error) in mallocPitch

I encounter the following problem when I try to extract frames and optical flow images.
OpenCV Error: Gpu API call (unknown error) in mallocPitch, file /data1/temporal-segment-networks-master/3rd-party/opencv-2.4.13/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 1134 terminate called after throwing an instance of 'cv::Exception' what(): /data1/temporal-segment-networks-master/3rd-party/opencv-2.4.13/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp:1134: error: (-217) unknown error in function mallocPitch

Though I delete the build folder and add the line
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch compute_37 -code sm_37)
to CMakeList.txt file, and then rebuild dense_flow, the problem is still there.

Does anyone solve this without reinstalling cuda?
Could anyone help me with this? Thank you very much.

does this support cuda-9.0

when I cmake CMake" Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):Could NOT find CUDA: Found unsuitable version "9.0", but required is exact
version "8.0" (found /usr/local/cuda-9.0)"

make -j error

Hi, yjxiong
After make -j , something was wrong.
dense_flow.h:9:27: fatal error: easylogging++.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/denseflow.dir/src/dense_flow.cpp.o] Error 1
make[1]: *** [CMakeFiles/denseflow.dir/all] Error 2

The version of Opencv is 3.2.0 or 3.0.0. A lot of methods have been tried!

Can you give me some ideas!

Thank you very much!

Not work for some videos

Hi, I am extracting the optical flow of ActivityNet dataset. All videos have been processed successfully except for about 20 of them. For these video, empty folders would be created. And no error was reported. I have confirmed these videos can be opened. I'm very confused...

dense_flow_gpu.cpp error

when I finished cmake .. ,I used the command "make", when it was in 81%,there is an issue.
[ 81%] Linking CXX executable extract_gpu
libdenseflow.a(dense_flow_gpu.cpp.o): In function calcDenseFlowGPU(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, int, int, std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&, std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&, std::vector<std::vector<unsigned char, std::allocator<unsigned char> >, std::allocator<std::vector<unsigned char, std::allocator<unsigned char> > > >&, int, int)': dense_flow_gpu.cpp:(.text+0x82b): undefined reference to cv::cuda::FarnebackOpticalFlow::create(int, double, bool, int, int, int, double, int)'
dense_flow_gpu.cpp:(.text+0x8a0): undefined reference to cv::cuda::OpticalFlowDual_TVL1::create(double, double, double, int, int, double, int, double, double, bool)' dense_flow_gpu.cpp:(.text+0x8ef): undefined reference to cv::cuda::BroxOpticalFlow::create(double, double, double, int, int, int)'
dense_flow_gpu.cpp:(.text+0x12eb): undefined reference to cv::cuda::split(cv::_InputArray const&, cv::cuda::GpuMat*, cv::cuda::Stream&)' libdenseflow.a(dense_flow_gpu.cpp.o): In function calcDenseFlowPureGPU(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, int, int, int, std::vector<std::vector<unsigned char, std::allocator >, std::allocator<std::vector<unsigned char, std::allocator > > >&, std::vector<std::vector<unsigned char, std::allocator >, std::allocator<std::vector<unsigned char, std::allocator > > >&, std::vector<std::vector<unsigned char, std::allocator >, std::allocator<std::vector<unsigned char, std::allocator > > >&)':
dense_flow_gpu.cpp:(.text+0x1b61): undefined reference to cv::cudacodec::createVideoReader(cv::String const&)' dense_flow_gpu.cpp:(.text+0x1c8e): undefined reference to cv::cuda::FarnebackOpticalFlow::create(int, double, bool, int, int, int, double, int)'
dense_flow_gpu.cpp:(.text+0x1d03): undefined reference to cv::cuda::OpticalFlowDual_TVL1::create(double, double, double, int, int, double, int, double, double, bool)' dense_flow_gpu.cpp:(.text+0x1d52): undefined reference to cv::cuda::BroxOpticalFlow::create(double, double, double, int, int, int)'
dense_flow_gpu.cpp:(.text+0x258d): undefined reference to `cv::cuda::split(cv::_InputArray const&, cv::cuda::GpuMat*, cv::cuda::Stream&)'
collect2: error: ld returned 1 exit status
CMakeFiles/extract_gpu.dir/build.make:143: recipe for target 'extract_gpu' failed
make[2]: *** [extract_gpu] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/extract_gpu.dir/all' failed
make[1]: *** [CMakeFiles/extract_gpu.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
My opencv version is 3.4.6,and cmake version is 3.5.1. My operation system is ubuntu16.04.
Could you help me.

flow_x and flow_y

Hi, I see that both the flow matrices flow_x as well as flow_y have non zero y and x components respectively. What do they actually signify?(Earlier I thought they are the flow values along the x and y direction, however since the flow in other axis is not zero I think they might have some other meaning)

能再详细点吗

my English is so poor, can you detail a little?
I don't know what to do after when I download your code
thank you

.mkv video file input acceptable or not?

I typed in the command suggested in the README, but using a .mkv video file instead of a .avi file.
Not surprisingly, I received error messages:

$ ./denseFlow_gpu -f sample_video_file.mkv -x ./tmp/flow_x/ -y ./tmp/flow_y -i ./tmp/images -b 20 -t 1 -d 0 -s 1
[h264 @ 0x899740] AVC: nal size 75
[h264 @ 0x899740] missing picture in access unit with size 75
[h264 @ 0xb24960] AVC: nal size 75
[h264 @ 0xb24960] AVC: nal size 75
[h264 @ 0xb24960] no frame!
[h264 @ 0x899740] AVC: nal size 75
[h264 @ 0x899740] missing picture in access unit with size 75
[h264 @ 0x951660] AVC: nal size 75
[h264 @ 0x951660] AVC: nal size 75
[h264 @ 0x951660] no frame!
....

However, surprisingly, I successfully obtained the .jpg files for both key frames and optical flow frames.
My main question is what are these error messages and should they be of concern?
Does the script accept .mkv file format?

/usr/bin/ld: cannot find -lopencv_dep_cudart

Hi, I use CentOS 7 and opencv-2.4.13.
When I run "make" ,I got this--

[maao@f5c93f0bb4ed build]$ make
Scanning dependencies of target denseFlow_gpu
[ 50%] Building CXX object CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o
[100%] Linking CXX executable denseFlow_gpu
/usr/bin/ld: cannot find -lopencv_dep_cudart
/usr/bin/ld: cannot find -lopencv_dep_nppial
/usr/bin/ld: cannot find -lopencv_dep_nppicc
/usr/bin/ld: cannot find -lopencv_dep_nppicom
/usr/bin/ld: cannot find -lopencv_dep_nppidei
/usr/bin/ld: cannot find -lopencv_dep_nppif
/usr/bin/ld: cannot find -lopencv_dep_nppig
/usr/bin/ld: cannot find -lopencv_dep_nppim
/usr/bin/ld: cannot find -lopencv_dep_nppist
/usr/bin/ld: cannot find -lopencv_dep_nppisu
/usr/bin/ld: cannot find -lopencv_dep_nppitc
collect2: error: ld returned 1 exit status
make[2]: *** [denseFlow_gpu] Error 1
make[1]: *** [CMakeFiles/denseFlow_gpu.dir/all] Error 2
make: *** [all] Error 2

Can you help me feed this?
Very thanks!

error after make

after make,i meet this problem:

/home/dense_flow-master/denseFlow_gpu.cpp: In function ‘int main(int, char**)’:
/home/dense_flow-master/denseFlow_gpu.cpp:71:2: error: reference to ‘FarnebackOpticalFlow’ is ambiguous
FarnebackOpticalFlow alg_farn;
^
In file included from /home/dense_flow-master/denseFlow_gpu.cpp:4:0:
/usr/include/opencv2/gpu/gpu.hpp:1847:18: note: candidates are: class cv::gpu::FarnebackOpticalFlow
class CV_EXPORTS FarnebackOpticalFlow
^
In file included from /home/dense_flow-master/denseFlow_gpu.cpp:1:0:
/usr/local/include/opencv2/video/tracking.hpp:551:20: note: class cv::FarnebackOpticalFlow
class CV_EXPORTS_W FarnebackOpticalFlow : public DenseOpticalFlow
^
/home/dense_flow-master/denseFlow_gpu.cpp:71:23: error: expected ‘;’ before ‘alg_farn’
FarnebackOpticalFlow alg_farn;
^
/home/dense_flow-master/denseFlow_gpu.cpp:111:42: error: ‘alg_farn’ was not declared in this scope
alg_farn(frame_0,frame_1,flow_u,flow_v);
^
make[2]: *** [CMakeFiles/denseFlow_gpu.dir/denseFlow_gpu.cpp.o] Error 1
make[1]: *** [CMakeFiles/denseFlow_gpu.dir/all] Error 2
make: *** [all] Error 2

how to fix it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.