Added parts of my developments to the vigra Computer Vision library...

Finally I managed to integrate the first few things, which I developed for my PhD thesis:

1. A local (window based) filter function environment. 
    applywindowfunction.hxx, medianfilter.hxx, specklefilters.hxx
It can be used to apply any given filter function on a complete image. Like convolveImage, this environment also supports correct border handling at the image boundaries. To demonstrate the use, I added a generic median filter and some of the most commonly used filters for speckle removal as well. 

2. A Coherence Enhancing Shock Filter
    shockfilter.hxx
This one was proposed by J. Weickert 2002 in "Coherence-Enhancing Shock Filters". It uses the Structure Tensor, a map and a weighted erosions/dilation function which perfoms "discrete upwinding" according to signums of the computed map. The results are images, that look like from Munch or van Gogh.

3. A correlation environment
    correlation.hxx
This one provides traditional correlation approaches using sliding windows as well as FFT powered fast versions of the cross-correlation as well as the normalized cross-correlation according to J.P. Lewis 1995: "Fast normalized cross correlation".

All of the included components are tested - tests are supplied by means of vigra tests (test/filters and test/correlation). And they are all documented by means of doxygen comments. All callable algorithms provide the new MultiArrayView calling mechanisms as well as the good old image iterators.
It seems that you just want to compute the standard deviation of each window. This can also be done by convolution with separable averaging filters. This may, in fact, be preferrable in order to avoid potential loss of precision in the integral images (especially, `sum_table2` will contain very large numbers).