public static void transformSq ( final GrayF32 input , final GrayF64 transformed ) { int indexSrc = input . startIndex ; int indexDst = transformed . startIndex ; int end = indexSrc + input . width ; double total = 0 ; for ( ; indexSrc < end ; indexSrc ++ ) { float value = input . data [ indexSrc ] ; transformed . data [ indexDst ++ ] = total += value * value ; } for ( int y = 1 ; y < input . height ; y ++ ) { indexSrc = input . startIndex + input . stride * y ; indexDst = transformed . startIndex + transformed . stride * y ; int indexPrev = indexDst - transformed . stride ; end = indexSrc + input . width ; total = 0 ; for ( ; indexSrc < end ; indexSrc ++ ) { float value = input . data [ indexSrc ] ; total += value * value ; transformed . data [ indexDst ++ ] = transformed . data [ indexPrev ++ ] + total ; } } }
Integral image of pixel value squared . floating point