# Integral image wrong values

Hello,

I'm trying to use cuda::integral method but it keeps on giving me wrong values. Here's my code:

```
void VarianceFilter::CUDA_nextIteration(const cv::cuda::GpuMat &img)
{
bool OpencvIntegral = true;
if (!enabled) return;
CUDA_release();
if (OpencvIntegral)
{
cv::Mat temp, temp2, temp3;
CUDA_integralImg = cv::cuda::GpuMat(temp.cols +1 , temp.rows+1 , CV_32SC1);
cuda::integral(img, CUDA_integralImg);
cuda::sqrIntegral(img, CUDA_integralImg_squared);
img.download(temp);
CUDA_integralImg.download(temp2);
CUDA_integralImg_squared.download(temp3);
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
printf(" %d", temp.at<char>(i, j));
}
printf("\n");
}
printf("\n");
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
printf(" %d", temp2.at<char>(i, j));
}
printf("\n");
}
printf("\n");
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
printf(" %d", temp3.at<char>(i, j));
}
printf("\n");
}
```

}

And the results that I'm receiving :

As you can see the values on integralImage aren't correct. They should be counted like this:

I will appreciate if you could point out my mistake, Thanks a lot