add_samples_image_class_knn
— Add training samples from an image to the training data of a
k-Nearest-Neighbor classifier.
add_samples_image_class_knn(Image, ClassRegions : : KNNHandle : )
add_samples_image_class_knn
adds training samples from the
Image
to the k-Nearest-Neighbor (k-NN) given by
KNNHandle
. add_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_knn
.
add_samples_image_class_knn
works analogously to
add_sample_class_knn
. The Image
must have a number
of channels equal to NumDim
, as specified with
create_class_knn
. ClassRegions
must be a tuple
containing of at least 2 regions. The order of the regions
in ClassRegions
determines the class of the pixels. If
there are no samples for a particular class in Image
an
empty region must be passed at the position of the class in
ClassRegions
. 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_knn
multiple times with different images and suitably chosen regions. The
regions in ClassRegions
should contain representative
training samples for the respective classes. Hence, they do not need
to cover the entire image. The regions in ClassRegions
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.
This operator modifies the state of the following input parameter:
The value of this parameter may not be shared across multiple threads without external synchronization.
Image
(input_object) (multichannel-)image →
object (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)
Training image.
ClassRegions
(input_object) region-array →
object
Regions of the classes to be trained.
KNNHandle
(input_control, state is modified) class_knn →
(handle)
Handle of the k-NN classifier.
If the parameters are valid, the operator
add_samples_image_class_knn
returns the value 2 (H_MSG_TRUE). If
necessary an exception is raised.
classify_image_class_knn
,
add_sample_class_knn
,
add_samples_image_class_svm
Foundation