Errors in cuda optical flow computation (Bug #4313)


Added by An Tran almost 10 years ago. Updated over 9 years ago.


Status:Cancelled Start date:2015-05-05
Priority:High Due date:
Assignee:Vladislav Vinogradov % Done:

0%

Category:gpu (cuda)
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Linux
Difficulty: HW Platform:x64
Pull request:

Description

Hi,
I wrote a code for my project, which load a video and compute optical flow using cv::cuda::BroxOpticalFlow or cv::cuda::FarnebackOpticalFlow. They have the same errors.

OpenCV version: 3.0.0-dev
OpenCV Error: The function/feature is not implemented (getGpuMat is available only for cuda::GpuMat and cuda::HostMem) in getGpuMat, file /home/beahacker/Downloads/opencv-new/opencv/modules/core/src/matrix.cpp, line 1419
terminate called after throwing an instance of 'cv::Exception'
what(): /home/beahacker/Downloads/opencv-new/opencv/modules/core/src/matrix.cpp:1419: error: (-213) getGpuMat is available only for cuda::GpuMat and cuda::HostMem in function getGpuMat

The program has unexpectedly finished.
/home/beahacker/Desktop/opencv-workspace/non-local_motion/src-build/non-local_motion crashed.

Hope to receive your responses.


main.cpp (1.2 kB) An Tran, 2015-05-05 09:52 am

CMakeLists.txt - cmake file to build, if necessary (845 Bytes) An Tran, 2015-05-05 09:52 am

main_updated.cpp - Updated source code with fixes (1.3 kB) Vladislav Vinogradov, 2015-05-19 10:50 am


History

Updated by An Tran almost 10 years ago

Updated by Ilya Lavrenov almost 10 years ago

  • Status changed from New to Open
  • Assignee set to Vladislav Vinogradov
  • Category set to gpu (cuda)
  • Target version set to 3.0
  • Difficulty set to Medium

Updated by Vladislav Vinogradov almost 10 years ago

It is not a bug, it is expected behavior.
The error message contains a hint:

getGpuMat is available only for cuda::GpuMat and cuda::HostMem in function getGpuMat

All CUDA module functions works only with cuda::GpuMat and cuda::HostMem.
You need explicitly create cuda::GpuMat and upload CPU data from Mat to it.

Attaching modified source code.

  • Status changed from Open to Cancelled
  • Difficulty deleted (Medium)
  • File main_updated.cpp added

Updated by An Tran over 9 years ago

Vladislav Vinogradov wrote:

It is not a bug, it is expected behavior.
The error message contains a hint:

[...]

All CUDA module functions works only with cuda::GpuMat and cuda::HostMem.
You need explicitly create cuda::GpuMat and upload CPU data from Mat to it.

Attaching modified source code.

Thank Vladislav,
I could not find documentations to use cuda optical flow algorithm properly.
Thank you so much.

Updated by An Tran over 9 years ago

Vladislav Vinogradov wrote:

It is not a bug, it is expected behavior.
The error message contains a hint:

[...]

All CUDA module functions works only with cuda::GpuMat and cuda::HostMem.
You need explicitly create cuda::GpuMat and upload CPU data from Mat to it.

Attaching modified source code.

Thank Vladislav,
I thought opencv would do it automatically from T-API. Creating an GpuMat manually seems to be a surprising to me.
@An

Updated by Steven Puttemans over 9 years ago

An Tran wrote:

Vladislav Vinogradov wrote:

It is not a bug, it is expected behavior.
The error message contains a hint:

[...]

All CUDA module functions works only with cuda::GpuMat and cuda::HostMem.
You need explicitly create cuda::GpuMat and upload CPU data from Mat to it.

Attaching modified source code.

Thank Vladislav,
I thought opencv would do it automatically from T-API. Creating an GpuMat manually seems to be a surprising to me.
@An

If you would like to use the T-API, then you will need to use the UMat container instead of the Mat container.
More information can be found here: http://www.learnopencv.com/opencv-transparent-api/

Updated by An Tran over 9 years ago

Steven Puttemans wrote:

An Tran wrote:

Vladislav Vinogradov wrote:

It is not a bug, it is expected behavior.
The error message contains a hint:

[...]

All CUDA module functions works only with cuda::GpuMat and cuda::HostMem.
You need explicitly create cuda::GpuMat and upload CPU data from Mat to it.

Attaching modified source code.

Thank Vladislav,
I thought opencv would do it automatically from T-API. Creating an GpuMat manually seems to be a surprising to me.
@An

If you would like to use the T-API, then you will need to use the UMat container instead of the Mat container.
More information can be found here: http://www.learnopencv.com/opencv-transparent-api/

Thank Steven,

Also available in: Atom PDF