# Why do the values returned from Brisk's smoothedIntensity it are very large, much larger than intensity values?

Hi,

I have a question regarding Brisk's function "smoothedIntensity".

Why do the values returned from it are very large, much larger than intensity values?

Should they be the size of intensity values (since they are smoothed intensities)? And why does Brisks uses an integral image?

I replaced the implementation with the following simple implementation that gives the sum of the 3x3 box around the pixel, could you please tell me if it's correct?

```
inline int
BRISK4::smoothedIntensity(const cv::Mat& image, const cv::Mat& integral, const float key_x,
const float key_y, const unsigned int scale, const unsigned int rot,
const unsigned int point) const
{
// get the float position
const BriskPatternPoint& briskPoint = patternPoints_[scale * n_rot_ * points_ + rot * points_ + point];
const float xf = briskPoint.x + key_x;
const float yf = briskPoint.y + key_y;
const int x = int(xf);
const int y = int(yf);
const int& imagecols = image.cols;
// get the sigma:
const float sigma_half = briskPoint.sigma;
const float area = 4.0f * sigma_half * sigma_half;
// calculate output:
//Gil changes here the returned val will be the sum of patch of 3X3
int ret_val = image.at<uchar>(y-1,x-1) + image.at<uchar>(y-1,x) + image.at<uchar>(y-1,x +1) +
image.at<uchar>(y,x-1) + image.at<uchar>(y,x) + image.at<uchar>(y,x +1) +
image.at<uchar>(y+1,x-1) + image.at<uchar>(y+1,x) + image.at<uchar>(y+1,x +1);
return ret_val;
}
```

The current smoothedIntensity implementation confused me, so I'm really not sure anymore.

Thanks,

Gil.

Several questions: why do you want to modify it? This function is only used internally in the descriptor-computation. I also doubt very much that your implementation is correct in any sense - why should be the sum of 9 pixels be a smoothed version? At least I'd take the average... The integral-image can be and is used for a fast calculation of sums of areas. So, again, I wouldn't touch this function, apparently the author(s) spent much brain energy in it and it probably has its sense ;) .

First, thank you very much for your response!!

I'm changing the function for research purposes. Basically, instead of comparing pairs of pixels, I want to compare small regions of size 3X3. I know it doesn't mean a smoothed version of the region, but the region itself.

So, if I do want to compare regions of size 3X3 instead of single pixels, is my implementation correct?

Thank you very much again!!

Well, the sum is correct (btw: imagecols, sigma_half, and area aren't needed then anymore) , but I doubt that it is correct in the sense of the function, but I guess you don't want this at all - I would then also call the function differently...

Thanks for your answer. You are indeed right, I should rename the function.

There is something that isn't clear to me - the original implementation should return the smoothed intensity at a certain pixel. So how come it returns values that are much larger then intensity values (255)?

Thanks!

Hm not so sure, maybe to widen the value range for the whole interpolation stuff? Sorry I am really not a Brisk expert, maybe s.o. else has a better idea...