boxfilter

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Fast convolve (average) for uniform, rectangular masks. Also known as a boxcar filter or a low pass filter.

Arguments and Return Values

Arguments: any three dimensional numeric array, a two dimensional box size and an ignore value

Return Value: a float numeric array the x and y dimensios and organization of the original with convolved data.

Usage

Syntax: boxfilter(obj = VAL [, x = INT] [, y = INT] [, z = INT] [, size = INT] [, ignore = VAL] [, verbose = 1])

The size can be either a size in x and y defining a rectangle or a square of side length of 'size'.

Pixels containing the ignore value will be filled in with convolved values if they are within one half of a box length from a pixel that has a valid value.

boxfilter() will only convolve in the x-y plane.

You can specify either an x and y for rectangular windows, or just size for a square window. Returns windowed average for all non-ignore pixels. If you specify verbose, it will return a structure containing the windowed mean, pixel count and standard deviation under the window (plus some other stuff for working with running sums).

Note: boxfilter() can use 24 bytes of memory per input pixel. It uses a LOT of memory and may exceed RAM limits if used on large objects. Use convolve, thm.convolve or rboxfilter for large arrays.

Examples

 dv> a
 345x600x1 array of byte, bsq format [207,000 bytes]

 dv> bx=boxfilter(a,x=21,y=1,ignore=0)
 345x600x1 array of float, bsq format [828,000 bytes]

 dv> by=boxfilter(a,x=1,y=21,ignore=0)
 345x600x1 array of float, bsq format [828,000 bytes]

 dv> bboth=boxfilter(a,size=21,ignore=0)
 345x600x1 array of float, bsq format [828,000 bytes]

 dv> bx=boxfilter(a,x=21,y=21,ignore=0,verbose=1)
 struct, 5 elements
     count: 345x600x1 array of int, bsq format [828,000 bytes]
     mean: 345x600x1 array of float, bsq format [828,000 bytes]
     sigma: 345x600x1 array of float, bsq format [828,000 bytes]
     n: 345x600x1 array of int, bsq format [828,000 bytes]
     s: 345x600x1 array of double, bsq format [1,656,000 bytes]

Images

bxfltpic1.png bxfltpic2.png bxfltpic3.png bxfltpic4.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 07-06-2009

Personal tools