lib/quagga.js
/**
	 * Computes an integral image of a given grayscale image.
	 * @param imageDataContainer {ImageDataContainer} the image to be integrated
	 */
Computes an integral image of a given grayscale image.
@param imageDataContainer {ImageDataContainer} the image to be integrated
Computes an integral image of a given grayscale image . @param imageDataContainer { ImageDataContainer } the image to be integrated
function computeIntegralImage2(imageWrapper, integralWrapper) {
	    var imageData = imageWrapper.data;
	    var width = imageWrapper.size.x;
	    var height = imageWrapper.size.y;
	    var integralImageData = integralWrapper.data;
	    var sum = 0,
	        posA = 0,
	        posB = 0,
	        posC = 0,
	        posD = 0,
	        x,
	        y;
	    posB = width;
	    sum = 0;
	    for (y = 1; y < height; y++) {
	        sum += imageData[posA];
	        integralImageData[posB] += sum;
	        posA += width;
	        posB += width;
	    }
	    posA = 0;
	    posB = 1;
	    sum = 0;
	    for (x = 1; x < width; x++) {
	        sum += imageData[posA];
	        integralImageData[posB] += sum;
	        posA++;
	        posB++;
	    }
	    for (y = 1; y < height; y++) {
	        posA = y * width + 1;
	        posB = (y - 1) * width + 1;
	        posC = y * width;
	        posD = (y - 1) * width;
	        for (x = 1; x < width; x++) {
	            integralImageData[posA] += imageData[posA] + integralImageData[posB] + integralImageData[posC] - integralImageData[posD];
	            posA++;
	            posB++;
	            posC++;
	            posD++;
	        }
	    }
	}
function computeIntegralImage2 ( imageWrapper , integralWrapper ) { var imageData = imageWrapper . data ; var width = imageWrapper . size . x ; var height = imageWrapper . size . y ; var integralImageData = integralWrapper . data ; var sum = 0 , posA = 0 , posB = 0 , posC = 0 , posD = 0 , x , y ; posB = width ; sum = 0 ; for ( y = 1 ; y < height ; y ++ ) { sum += imageData [ posA ] ; integralImageData [ posB ] += sum ; posA += width ; posB += width ; } posA = 0 ; posB = 1 ; sum = 0 ; for ( x = 1 ; x < width ; x ++ ) { sum += imageData [ posA ] ; integralImageData [ posB ] += sum ; posA ++ ; posB ++ ; } for ( y = 1 ; y < height ; y ++ ) { posA = y * width + 1 ; posB = ( y - 1 ) * width + 1 ; posC = y * width ; posD = ( y - 1 ) * width ; for ( x = 1 ; x < width ; x ++ ) { integralImageData [ posA ] += imageData [ posA ] + integralImageData [ posB ] + integralImageData [ posC ] - integralImageData [ posD ] ; posA ++ ; posB ++ ; posC ++ ; posD ++ ; } } }
Computes an integral image of a given grayscale image.
Computes an integral image of a given grayscale image .
// sum up first column