knn

[ XITE Reference Manual | XITE home ]

Name

knn - k nearest neighbour noise reduction

Syntax

 #include <xite/knn.h>

 int knn( IBAND input, IBAND output, int n,
    int k );

Description

knn performs k nearest neighbour noise reduction, averaging over the center pixel and the k nearest neighbours. If n is even n+1 is used. Uses histogram updating.

n is the width of a square window. k is the number of neighbours to average over.

Restrictions

input and output must have pixeltype unsigned byte.

Reference

L. S. Davis & A. Rosenfeld:"Noise Cleaning by Iterated Local Averaging" IEEE trans. on syst., man, and cyb., vol smc-8, no 9, 1978.

See also

knn(1), mbknn(3), kncn(3), mbkncn(3)

Return value

 0 => ok
 1 => Bad input pixel type
 2 => Bad output pixel type
 3 => Bad n value (less than 1)
 4 => Bad k value (less than 1 or larger than n**2-1)

Author

Tor Lønnestad, BLAB, Ifi, UiO

Id

$Id: knn.c,v 1.24 1997/01/10 16:03:52 svein Exp $