# filters.neighborclassifier

The neighborclassifier filter allows you update the value of the classification for specific points to a value determined by a K-nearest neighbors vote. For each point, the k nearest neighbors are queried and if more than half of them have the same value, the filter updates the selected point accordingly

For example, if an automated classification procedure put/left erroneous vegetation points near the edges of buildings which were largely classified correctly, you could try using this filter to fix that problem.

Similiarly, some automated classification processes result in prediction for only a subset of the original point cloud. This filter could be used to extrapolate those predictions to the original.

Default Embedded Stage

This stage is enabled by default

## Example 1

This pipeline updates the Classification of all points with classification 1 (unclassified) based on the consensus (majority) of its nearest 10 neighbors.

    [
        "autzen_class.las",
        {
            "type" : "filters.neighborclassifier",
            "domain" : "Classification[1:1]",
            "k" : 10
        },
        "autzen_class_refined.las"
    ]

## Example 2

This pipeline moves all the classifications from “pred.txt” to src.las. Any points in src.las that are not in pred.txt will be assigned based on the closest point in pred.txt.

    [
        "src.las",
        {
            "type" : "filters.neighborclassifier",
            "k" : 1,
            "candidate" : "pred.txt"
        },
        "dest.las"
    ]

## Options

candidate

  A filename which points to the point cloud containing the points which will do the voting. If not specified, defaults to the input of the filter.

domain

  A range which selects points to be processed by the filter. Can be specified multiple times. Points satisfying any range will be processed

k

  An integer which specifies the number of neighbors which vote on each selected point.

where

  An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]

where_merge

  A strategy for merging points skipped by a ‘where’ option when running in standard mode. If `true`, the skipped points are added to the first point view returned by the skipped filter. If `false`, skipped points are placed in their own point view. If `auto`, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default: `auto`]