**CIGAL Reference Manual, Chapter 3 (Functions): FILTER** ===== FILTER -- Perform a non-convolution neighborhood transform of an image ===== **usage: vdst = filter(vsrc,ftype,fsize,offset,minval,maxval,shift,vmask,dmax)** FILTER is a form of convolution wherein each pixel in an image is replaced by the result of a function performed on that pixel and its 8 immediate neighbors. This is different from the [[jvs:cigal:manual:chapter3:convolve|CONVOLVE(3)]] function in that the convolution function is not specified by a kernel matrix. Instead, the function is selected from a predefined list using the FTYPE argument. Legal FTYPE values are: 0 MAX Replace with the maximum value of its neighbors 1 MIN Replace with the minimum value of its neighbors 2 ADAPT 3 MEAN Replace with the mean of its neighbors 4 STDEV Replace with the standard deviation of its neighbors 5 MEDIAN Replace with the median of its neighbors 6 ERODE (b) Thin objects by 1 pixel on each side 7 DILATE (b) Expand objects by 1 pixel on each side 8 SOBEL Perform a Sobel edge enhancement: a b c x = (a+2c+c)-(g+2h+i) d e f -> y = (a+2d+g)-(c+2f+i) g h i e' = sqrt(x**2 + y**2) 9 CONNECT (b) 10 NEIGHBORS (b) 11 FILLIN Replace zero values with the mean of its non-zero neighbors 12 SMOOTH Replace each value with the mean of those neighbors that differ by no more than DMAX from the original center value (DMAX default is 10) (b) indicates filters that treat VSRC as binary data, either 0 or 1-- in which case any data pixel value greater than MAXVAL is treated as a 1. **See Also:**\\ [[jvs:cigal:manual:chapter3:convolve|CONVOLVE(3)]], [[jvs:cigal:manual:chapter3:smooth|SMOOTH(3)]] [[jvs:cigal|CIGAL Home]], [[jvs:cigal:manual|CIGAL Manual]], [[jvs:cigal:manual:chapter3|Functions List]], [[jvs:cigal:manual:help|Manual Help]]