Ask Your Question
0

gpu::histEven delivers incorrect number of Pixels

asked 2014-11-02 08:10:40 -0600

pheips gravatar image

Hi,

I am currently exploring the gpu OpenCV algorithms and recognized, that gpu::histEven might be buggy. gpu::histEven delivers the incorrect number of pixels when all bins are summed up, at least for certain images.

The following code delivers 1.536.000 pxls instead of 2.000.000 for an image of size 2000x1000. However if I change the image dimension to 1000x2000 I get the correct number of pixels.

gpu::calcHist works fine by the way. Am I doing something wrong, or is this a bug? I use OpenCV 2.4.9 and Visual Studio 2012 and my graphics card is a NVidia NVS 4200M.

Thanks in advance!

cv::gpu::GpuMat hist;
cv::gpu::GpuMat srcImg(2000,1000,CV_8U,cv::Scalar(127));
cv::gpu::GpuMat srcImg2(1000,2000,CV_8U,cv::Scalar(127));

cv::gpu::histEven(srcImg,hist,256,0,256);
cv::Mat tmp;
hist.download(tmp);
int sum=0;
for(int i=0; i<256;++i)
    sum +=tmp.at<int>(0,i);
std::cout << "Num Pxls GPU histEven 2000x1000: " << sum << std::endl;

cv::gpu::histEven(srcImg2,hist,256,0,256);
hist.download(tmp);
sum=0;
for(int i=0; i<256;++i)
    sum +=tmp.at<int>(0,i);
std::cout << "Num Pxls GPU histEven 1000x2000: " << sum << std::endl;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-11-02 08:23:38 -0600

pheips gravatar image

I just checked on my other PC with a GTX280 and it works correctly there. So I guess it has somethind to do with the Graphics card. So I gues something goes wrong on the GPU and I get an incomplete result? Any other suggestion?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-02 08:10:40 -0600

Seen: 283 times

Last updated: Nov 02 '14