Question

I have an Integral Image which I computed from a normal gray Image. I checked it and it look like this one:

https://i.stack.imgur.com/qOdHa.jpg

Now I apply some Box Filters on the Integral Image, for example the Box Filters which are used in SURF.

http://i.imgur.com/bPc8bfN.png

My Problem now is that the Filter reacts at the Image corners. I think it comes from outshifting of the filter boxes. So now I know that I have to Implement some border handling. First I thought it helps to set the first row and column of the Integralimage to zero, but it didn't help. I found this on Stackoverflow:

Dealing with Boundary conditions / Halo regions in CUDA

How is the best way to apply this techniques to my Integralimage? Does it make sense to build some edge mirro, clamp etc. to the Integral Image? Or should I do this with the InputeImage befor computing the Integral Image? Has someone experience with that or is there a typicall way to handle this problem?

Edit:

"instead you want to do some index fiddling in your filter code when you are at the border." Okay at the moment I do this, so i can only repeat myself, the first col and row of the IntegralImage are zeros.

int GetBoxIntegral(int xUp, int yUp, int xBot, int yBot)
{
    yUp = Math.min(Math.max(0, yUp), m_integralImage.GetHeight() - 1); 
    xUp = Math.min(Math.max(0, xUp), m_integralImage.GetWidth() - 1);
    yBot = Math.min(Math.max(0, yBot), m_integralImage.GetHeight() - 1);
    xBot = Math.min(Math.max(0, xBot), m_integralImage.GetWidth() - 1);



    int A = 0, B = 0, C = 0, D = 0;
    A = m_integralImage.GetPixel(xUp, yUp);
    B = m_integralImage.GetPixel(xBot, yUp);
    C = m_integralImage.GetPixel(xUp, yBot);
    D = m_integralImage.GetPixel(xBot, yBot);

    return Math.max(0, A + D - B - C);
}
Was it helpful?

Solution

1)"How is the best way to apply this techniques to my Integralimage?" It all depends on results that you want. For example, for feature detection, it has no sense to catch up the pixels close the borders and all filters should lie inside image.

2) "Does it make sense to build some edge mirro, clamp etc. to the Integral Image? Or should I do this with the InputeImage befor computing the Integral Image?" Faster to build integral image with borders, fewer computations possible.

3) "Has someone experience with that or is there a typicall way to handle this problem?" I know 2 typical solutions. First, ignore all pixels that require computations outside image (feature detection). Second , clamp the rectangle of integral image query (box blur filter).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top