Skip to content

Stitching module is not compatible with CUDA8 due to GraphCut has been removed in CUDA8 #8792

Open

Description

@ustcjerry
System information (version)
  • OpenCV => 3.2
  • Operating System / Platform => Win10 64bit
  • Compiler => Visual Studio 2010/Visual Studio 2015
Detailed description

When I want to use GPU to accelerate the stitching procedure with OpenCV3.2 & CUDA8. I get this error:

Opencv Error: The function/feature is not implemented ( The called functionality is disabled for current build or platform )

In the source code seam_finders.cpp line 1445:

cuda::graphcut(terminals_d, leftT_d, rightT_d, top_d, bottom_d, labels_d, buf_d);

So the problem is the function graphcut which stitching bases on is removed in CUDA8 but not updated in the OpenCV source code.

According to this issue #6510

In the graphcuts.cpp line 45-50:

// GraphCut has been removed in NPP 8.0
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)

void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); }
void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); }

So we just simply deprecated the function without looking relevance.

Steps to reproduce

Compile Opencv3.2 with CUDA8 then use stitching:

Stitcher::Mode mode = Stitcher::PANORAMA;
Ptr<Stitcher> stitcher = Stitcher::create(mode, try_use_gpu=1);
Stitcher::Status status = stitcher->stitch(input_images, pano);

then we will meet the error.

My solution:

Since it is hard for me to modify the original source code, so I use the CPU version of GraphCut in the stitching procedure.
It'll lose some speed but the rest part of the stitching procedure is working which would save a lot of time compared to the totally CPU version code.

stitcher->setSeamFinder(makePtr<detail::GraphCutSeamFinder>(detail::GraphCutSeamFinderBase::COST_COLOR));

Please consider updating the GraphCut code to compatible with CUDA8 to fundamentally fix the problem.

Related link:
https://devtalk.nvidia.com/default/topic/973151/no-nppgrabcut-on-cuda-8-0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions