gpu::calcHist()
i'm trying to compare the computation of histogram on cpu and gpu using gpucv but there's something i don't understand. The results are differents and i don't understand why. this is the code i'm using for gpucv
cv::Mat histImage;
histImage = cvLoadImage(img.toStdString().c_str(), CV_8UC1);
gpu::GpuMat devImage, result;
devImage.upload(histImage);
gpu::calcHist(devImage, result);
Thanks for helping
Could you add your CPU code? And what the difference?
Hi. the output of the CPU and the GPU are differents, GPUCV output matrice is full of zeros and i don't understand where my error comes from while using the gpu calcHist
This's the CPU code
selectedImage1 = image;
vector<Mat> bgr_planes1;
split (selectedImage1, bgr_planes1);
int histSize1 = 256;
float range1[] = {0, 256};
const float* histRange1 = {range1};
bool uniform = true; bool accumulate = false;
cv::calcHist(&bgr_planes1[0], 1, 0, Mat(), b_hist1, 1, &histSize1, &histRange1, uniform, accumulate);
cv::calcHist(&bgr_planes1[1], 1, 0, Mat(), g_hist1, 1, &histSize1, &histRange1, uniform, accumulate);
cv::calcHist(&bgr_planes1[2], 1, 0, Mat(), r_hist1, 1, &histSize1, &histRange1, uniform, accumulate);
Thx for helping
Did you check that your image was loaded correctly :
assert( !histImage.empty() )
?my image is loaded correctly after checking
I am trying the same histCalc on GPU using opencv3.0 so the namespace is cuda::calcHist() rest of the code is same as above but I am getting a runtime error OpenCV Error: The function/feature is not implemented (getGpuMat is available only for cuda::GpuMat and cuda::HostMem) in getGpuMat, file /home/ubuntu/cv/modules/core/src/matrix.cpp, line 1419 terminate called after throwing an instance of 'cv::Exception' what(): /home/ubuntu/cv/modules/core/src/matrix.cpp:1419: error: (-213) getGpuMat is available only for cuda::GpuMat and cuda::HostMem in function getGpuMat