Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is cuda::HOG working with cuda::Stream?

Hi everyone,

I'm trying to use cuda::HOG asynchronously by means of the cuda::Stream.

In particular, I'm trying to use the method compute which seems to provide such capability. Unfortunately, however, when passing a cuda::Stream invoking the function I get the following error:

OpenCV Error: Assertion failed (!stream) in compute, file /tmp/opencv3-20170201-80029-q1jvsi/opencv-3.2.0/modules/cudaobjdetect/src/hog.cpp, line 461

which points to a

CVAssert(!stream)

in the above mentioned hog.cpp file.

Here is a simplified snippet of the code I'm trying to run:

/* Suppose to have: using namespace cv and using namespace cv::cuda*/

Mat      img;
GpuMat   cuda_img;
GpuMat   cuda_img_alpha;
GpuMat   cuda_descriptors;
Stream   stream[10];
Ptr<HOG> cuda_hog_ = HOG::create(Size(320, 240), Size(16, 16), Size(8, 8), Size(8, 8), 9);

for (int i = 0; i < 10; ++i)
{
    ...
    /* I have stored an RGB image in img */

    cuda_img.upload(img, stream[i]);
    cuda::cvtColor(cuda_img, cuda_img_alpha, COLOR_BGR2BGRA, 4, stream[i]);
    cuda_hog->compute(cuda_img_alpha, cuda_descriptors, stream[i]);
}

Everything goes smoothly in both upload and cvtColor, but the assertion is raised within HOG::compute().

Is anyone aware whether it is still an unimplemented feature or I'm doing something wrong?

Is cuda::HOG working with cuda::Stream?

Hi everyone,

I'm trying to use cuda::HOG asynchronously by means of the cuda::Stream.

In particular, I'm trying to use the method compute which seems to provide such capability. Unfortunately, however, when passing a cuda::Stream invoking the function I get the following error:

OpenCV Error: Assertion failed (!stream) in compute, file /tmp/opencv3-20170201-80029-q1jvsi/opencv-3.2.0/modules/cudaobjdetect/src/hog.cpp, line 461

which points to a

CVAssert(!stream)

in the above mentioned hog.cpp file.

Here is a simplified snippet of the code I'm trying to run:

/* Suppose to have: using namespace cv and using namespace cv::cuda*/

Mat      img;
GpuMat   cuda_img;
GpuMat   cuda_img_alpha;
GpuMat   cuda_descriptors;
Stream   stream[10];
Ptr<HOG> cuda_hog_ = HOG::create(Size(320, 240), Size(16, 16), Size(8, 8), Size(8, 8), 9);

for (int i = 0; i < 10; ++i)
{
    ...
    /* I have stored an RGB image in img */

    cuda_img.upload(img, stream[i]);
    cuda::cvtColor(cuda_img, cuda_img_alpha, COLOR_BGR2BGRA, 4, stream[i]);
    cuda_hog->compute(cuda_img_alpha, cuda_descriptors, stream[i]);
}

Everything goes smoothly in both upload and cvtColor, but the assertion is raised within HOG::compute().

Is anyone aware whether it is still an unimplemented feature or I'm doing something wrong?