CImage:FiltBlockSum


The FiltBlockSum method sums neighboring pixels in blocks of m x n to make a smaller image having higher signal level and higher signal to noise ratio in each pixel.

Syntax

bSuccess = CImage:FiltBlockSum( ColBlock, RowBlock )

bSuccess = CImage:FiltBlockSum( ColBlock, RowBlock, datatype )

where

    ColBlock is the number, m, of adjacent columns to sum.

    RowBlock is the number, n, of adjacent rows to sum.

    datatype is the data type for the output image, defaults to "same" if not specified.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

This method increases the signal to noise ratio by sqrt(mn) for using blocking factors of m and n. This approximates the effect of using a binning mode during image acquisition except that each blocked pixel will have m x n units of readout noise in its total noise budget whereas a binned pixel of the same blocking factor will have 1 unit of readout noise in its total noise budget.

Usually the output data type should be enlarged to handle the higher pixel values in the summed image. For example, if the data are 16 bit integer type, then the output data type should at least be "int" to handle the m x n increase in signal level of each pixel.

Example

Suppose an image is displayed in a CImageView named V. The following script block sums the image to 2x2 super pixels and then redisplays the new image:

I = V:GetImage()

-- attach the current displayed image

I:FiltBlockSum(2,2,"int")

-- average the pixels and convert to 32 bit integer.

V:Update()

-- update the display after the scale

V:SetZoom(2)

-- magnify the image 2x

Related Topics

FiltBlockAvg

CImage class