add_samples_image_class_knnT_add_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn (Operator)

Name

add_samples_image_class_knnT_add_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn — Add training samples from an image to the training data of a k-Nearest-Neighbor classifier.

Signature

add_samples_image_class_knn(Image, ClassRegions : : KNNHandle : )

Herror T_add_samples_image_class_knn(const Hobject Image, const Hobject ClassRegions, const Htuple KNNHandle)

void AddSamplesImageClassKnn(const HObject& Image, const HObject& ClassRegions, const HTuple& KNNHandle)

void HImage::AddSamplesImageClassKnn(const HRegion& ClassRegions, const HClassKnn& KNNHandle) const

void HClassKnn::AddSamplesImageClassKnn(const HImage& Image, const HRegion& ClassRegions) const

static void HOperatorSet.AddSamplesImageClassKnn(HObject image, HObject classRegions, HTuple KNNHandle)

void HImage.AddSamplesImageClassKnn(HRegion classRegions, HClassKnn KNNHandle)

void HClassKnn.AddSamplesImageClassKnn(HImage image, HRegion classRegions)

def add_samples_image_class_knn(image: HObject, class_regions: HObject, knnhandle: HHandle) -> None

Description

add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn adds training samples from the ImageImageImageImageimageimage to the k-Nearest-Neighbor (k-NN) given by KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleknnhandle. add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn is used to store the training samples before a classifier is used for the pixel classification of multichannel images with classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnnClassifyImageClassKnnclassify_image_class_knn. add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn works analogously to add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnAddSampleClassKnnadd_sample_class_knn. The ImageImageImageImageimageimage must have a number of channels equal to NumDimNumDimNumDimNumDimnumDimnum_dim, as specified with create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnncreate_class_knn. ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions must be a tuple containing of at least 2 regions. The order of the regions in ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions determines the class of the pixels. If there are no samples for a particular class in ImageImageImageImageimageimage an empty region must be passed at the position of the class in ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions. With this mechanism it is possible to use multiple images to add training samples for all relevant classes to the k-NN classifier by calling add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn multiple times with different images and suitably chosen regions. The regions in ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions should contain representative training samples for the respective classes. Hence, they do not need to cover the entire image. The regions in ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions should not overlap each other, as these samples from overlapping areas would be assigned to multiple classes in the training data, which may lead to a lower classification performance.

Execution Information

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters

ImageImageImageImageimageimage (input_object)  (multichannel-)image objectHImageHObjectHImageHobject (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)

Training image.

ClassRegionsClassRegionsClassRegionsClassRegionsclassRegionsclass_regions (input_object)  region-array objectHRegionHObjectHRegionHobject

Regions of the classes to be trained.

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleknnhandle (input_control, state is modified)  class_knn HClassKnn, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the k-NN classifier.

Result

If the parameters are valid, the operator add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnnAddSamplesImageClassKnnadd_samples_image_class_knn returns the value TRUE. If necessary an exception is raised.

Possible Predecessors

create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnncreate_class_knn

Possible Successors

train_class_knntrain_class_knnTrainClassKnnTrainClassKnnTrainClassKnntrain_class_knn

Alternatives

add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnAddSampleClassKnnadd_sample_class_knn

See also

classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnnClassifyImageClassKnnclassify_image_class_knn, add_sample_class_knnadd_sample_class_knnAddSampleClassKnnAddSampleClassKnnAddSampleClassKnnadd_sample_class_knn, add_samples_image_class_svmadd_samples_image_class_svmAddSamplesImageClassSvmAddSamplesImageClassSvmAddSamplesImageClassSvmadd_samples_image_class_svm

Module

Foundation