CImage:FiltBlockSum


The FiltBlockSum method sums neighboring pixels in m x n blocks to increase the numeric capcity and signal to noise ratio of the image in return for lower spatial resolution. Also see the related FiltBlockAvg method.

Syntax

bResult = CImage:FiltBlockSum( ColBlock, RowBlock, pixel_type=nil )

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

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

bullet.gif    pixel_type is an optional pixel type for the output image, defaults to "same" if not specified.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

Remarks

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 pixel 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 pixel type should at least be "long" 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,"long")

-- 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

CImage class, FiltBlockAvg


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.