From 0af7597d3623957ebc2eea248d6870e7a8f6c19c Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Wed, 14 Jan 2015 14:01:34 +0300 Subject: [PATCH] fix CUDA HOG for multi GPU systems: move GPU constants initialization from constructor to compute method --- modules/cudaobjdetect/src/hog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cudaobjdetect/src/hog.cpp b/modules/cudaobjdetect/src/hog.cpp index f71bf2b5ad..a10afa0ae0 100644 --- a/modules/cudaobjdetect/src/hog.cpp +++ b/modules/cudaobjdetect/src/hog.cpp @@ -127,9 +127,6 @@ cv::cuda::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size bl Size cells_per_block = Size(block_size.width / cell_size.width, block_size.height / cell_size.height); CV_Assert(cells_per_block == Size(2, 2)); - - cv::Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride); - hog::set_up_constants(nbins, block_stride.width, block_stride.height, blocks_per_win.width, blocks_per_win.height); } size_t cv::cuda::HOGDescriptor::getDescriptorSize() const @@ -221,6 +218,9 @@ void cv::cuda::HOGDescriptor::computeGradient(const GpuMat& img, GpuMat& _grad, void cv::cuda::HOGDescriptor::computeBlockHistograms(const GpuMat& img) { + cv::Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride); + hog::set_up_constants(nbins, block_stride.width, block_stride.height, blocks_per_win.width, blocks_per_win.height); + computeGradient(img, grad, qangle); size_t block_hist_size = getBlockHistogramSize();