I recently read about image integral and I can understand the mathematical way of doing it. Some how, I noted that it is as well can compute the statistical value such as mean, std dev, variance. So, the question is how to calculate the statistical value after the integral image is done? We can find the statistical value from a normal image therefore why and how do we need integral image and then find statistical value for?
Each pixel of the integral image (also called summed area table) contains the sum of all pixels that lie in the top-left area from this pixel. By using smart subtractions and additions you can actually get a sum of any rectangular area: [ Taken from http://en.wikipedia.org/wiki/Summed_area_table ]
SUM(ABCD) = C - B - D + A
(from the [0, 0], C
rectangle subtract two rectangles [0,0], D
and [0,0], B
and add back [0,0], A
which was subtracted twice).
This is very handy because you can get the sum of any area just using 4 trivial operations. In other words, it's blazing fast and independent on the size of the area!
If you want to get an average of the area, just divide its sum by its size.
Getting variance is a bit trickier - you will need two integral images. One will be classical and the other one will be based on squared values - first square all intensities and then make the integral image from them. The rest is just plugging values in the following equation:
Var(area) = Avg(area^2) - Avg(area)^2
You get the first term from the squared integral image and the second term from the classical integral image. It's still only 9 simple operations to calculate. Neat, isn't it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With