Using Samples of cudaoptflow, I am trying to run Nvidia Optical Flow sdk.
code :
while(1)
{
Mat frame;
cap >> frame; //read every frame
if(frame.empty())
break;
Mat reference_image = Mat::zeros(frame.size(), frame.type());
Ptr<NvidiaOpticalFlow_1_0> nvof = NvidiaOpticalFlow_1_0::create(
frame.size().width, frame.size().height, perfPreset,
true, false, false, gpuId);
Mat flowx, flowy, flowxy, upsampledFlowXY, image;
nvof->calc(frame, reference_image, flowxy);
nvof->upSampler(flowxy, frame.size().width, frame.size().height,
nvof->getGridSize(), upsampledFlowXY);
Mat planes[] = { flowx, flowy };
split(upsampledFlowXY, planes);
flowx = planes[0]; flowy = planes[1];
drawOpticalFlow(flowx, flowy, image, 10);
outputv.write(image);
char c = cv::waitKey(25);
if (c ==27)
break;
nvof->collectGarbage();
}
Error on running:
OpenCV(4.1.2) /docker/opencv_contrib-4.1.2/modules/cudaoptflow/src/nvidiaOpticalFlow.cpp:172: error: (-6:Unknown error code -6) Cannot find NvOF library. in function 'LoadNvidiaModules'
System :
OPENCV - 4.1.2
Installed it inside docker container with cuda 10.1 : https://hub.docker.com/r/nvidia/cuda/
Image : nvidia/cuda
cuda_version : 10.1
OS: ubuntu18.04