ClassesClassesClassesClasses | | | | Operators

classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn (Operator)

Name

classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn — Classify an image with a k-Nearest-Neighbor classifier.

Signature

classify_image_class_knn(Image : ClassRegions, DistanceImage : KNNHandle, RejectionThreshold : )

Herror classify_image_class_knn(const Hobject Image, Hobject* ClassRegions, Hobject* DistanceImage, const Hlong KNNHandle, double RejectionThreshold)

Herror T_classify_image_class_knn(const Hobject Image, Hobject* ClassRegions, Hobject* DistanceImage, const Htuple KNNHandle, const Htuple RejectionThreshold)

Herror classify_image_class_knn(Hobject Image, Hobject* ClassRegions, Hobject* DistanceImage, const HTuple& KNNHandle, const HTuple& RejectionThreshold)

HRegionArray HImage::ClassifyImageClassKnn(HImage* DistanceImage, const HClassKnn& KNNHandle, const HTuple& RejectionThreshold) const

HRegionArray HClassKnn::ClassifyImageClassKnn(const HImage& Image, HImage* DistanceImage, const HTuple& RejectionThreshold) const

void ClassifyImageClassKnn(const HObject& Image, HObject* ClassRegions, HObject* DistanceImage, const HTuple& KNNHandle, const HTuple& RejectionThreshold)

HRegion HImage::ClassifyImageClassKnn(HImage* DistanceImage, const HClassKnn& KNNHandle, double RejectionThreshold) const

HRegion HClassKnn::ClassifyImageClassKnn(const HImage& Image, HImage* DistanceImage, double RejectionThreshold) const

void HOperatorSetX.ClassifyImageClassKnn(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ClassRegions, [out] IHUntypedObjectX*DistanceImage, [in] VARIANT KNNHandle, [in] VARIANT RejectionThreshold)

IHRegionX* HImageX.ClassifyImageClassKnn(
[out] IHImageX*DistanceImage, [in] IHClassKnnX* KNNHandle, [in] double RejectionThreshold)

IHRegionX* HClassKnnX.ClassifyImageClassKnn(
[in] IHImageX* Image, [out] IHImageX*DistanceImage, [in] double RejectionThreshold)

static void HOperatorSet.ClassifyImageClassKnn(HObject image, out HObject classRegions, out HObject distanceImage, HTuple KNNHandle, HTuple rejectionThreshold)

HRegion HImage.ClassifyImageClassKnn(out HImage distanceImage, HClassKnn KNNHandle, double rejectionThreshold)

HRegion HClassKnn.ClassifyImageClassKnn(HImage image, out HImage distanceImage, double rejectionThreshold)

Description

classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn performs a pixel classification with a k-Nearest-Neighbor classifier (k-NN) KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleKNNHandle on the multichannel image ImageImageImageImageImageimage. Before calling classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn the k-NN classifier must be trained with train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn. ImageImageImageImageImageimage must have NumDimNumDimNumDimNumDimNumDimnumDim channels, as specified with create_class_knncreate_class_knnCreateClassKnncreate_class_knnCreateClassKnnCreateClassKnn. On output, ClassRegionsClassRegionsClassRegionsClassRegionsClassRegionsclassRegions contains NumClassesNumClassesNumClassesNumClassesNumClassesnumClasses regions as the result of the classification. The parameter RejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdrejectionThreshold can be used to reject pixels that have an uncertain classification. RejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdrejectionThreshold represents a threshold on the distance to the nearest neighbor returned by the classification. All pixels having a probability below RejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdrejectionThreshold are not assigned to any class. DistanceImageDistanceImageDistanceImageDistanceImageDistanceImagedistanceImage contains the distance of each pixel to its nearest neighbor.

Parallelization

Parameters

ImageImageImageImageImageimage (input_object)  (multichannel-)image objectHImageHImageHImageHImageXHobject (byte / cyclic / direction / int1 / int2 / uint2 / int4 / real)

Input image.

ClassRegionsClassRegionsClassRegionsClassRegionsClassRegionsclassRegions (output_object)  region-array objectHRegionHRegionHRegionArrayHRegionXHobject * (real)

Segmented classes.

DistanceImageDistanceImageDistanceImageDistanceImageDistanceImagedistanceImage (output_object)  image objectHImageHImageHImageHImageXHobject *

Distance of the pixel's nearest neighbor.

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleKNNHandle (input_control)  class_knn HClassKnn, HTupleHTupleHClassKnn, HTupleHClassKnnX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the k-NN classifier.

RejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdRejectionThresholdrejectionThreshold (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Threshold for the rejection of the classification.

Default value: 0.5

Suggested values: 0.0, 0.1, 0.2, 0.3, 5.0, 10.0, 255.0

Restriction: RejectionThreshold >= 0.0

Example (HDevelop)

read_image (Image, 'ic')
gen_rectangle1 (Board, 80, 320, 110, 350)
gen_rectangle1 (Capacitor, 359, 263, 371, 302)
gen_rectangle1 (Resistor, 200, 252, 290, 256)
gen_rectangle1 (IC, 180, 135, 216, 165)
concat_obj (Board, Capacitor, Classes)
concat_obj (Classes, Resistor, Classes)
concat_obj (Classes, IC, Classes)
create_class_knn (3, KNNHandle)
add_samples_image_class_knn (Image, Classes, KNNHandle)
get_sample_num_class_knn (KNNHandle, NumSamples)
train_class_knn (KNNHandle, [], [])
classify_image_class_knn (Image, ClassRegions, DistanceImage, KNNHandle, 0.5)
dev_display (ClassRegions)
clear_class_knn (KNNHandle)

Result

If the parameters are valid, the operator classify_image_class_knnclassify_image_class_knnClassifyImageClassKnnclassify_image_class_knnClassifyImageClassKnnClassifyImageClassKnn returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors

train_class_knntrain_class_knnTrainClassKnntrain_class_knnTrainClassKnnTrainClassKnn, read_class_knnread_class_knnReadClassKnnread_class_knnReadClassKnnReadClassKnn

Alternatives

classify_image_class_svmclassify_image_class_svmClassifyImageClassSvmclassify_image_class_svmClassifyImageClassSvmClassifyImageClassSvm, classify_image_class_mlpclassify_image_class_mlpClassifyImageClassMlpclassify_image_class_mlpClassifyImageClassMlpClassifyImageClassMlp, classify_image_class_gmmclassify_image_class_gmmClassifyImageClassGmmclassify_image_class_gmmClassifyImageClassGmmClassifyImageClassGmm, classify_image_class_lutclassify_image_class_lutClassifyImageClassLutclassify_image_class_lutClassifyImageClassLutClassifyImageClassLut, class_ndim_boxclass_ndim_boxClassNdimBoxclass_ndim_boxClassNdimBoxClassNdimBox, class_ndim_normclass_ndim_normClassNdimNormclass_ndim_normClassNdimNormClassNdimNorm, class_2dim_supclass_2dim_supClass2dimSupclass_2dim_supClass2dimSupClass2dimSup

See also

add_samples_image_class_knnadd_samples_image_class_knnAddSamplesImageClassKnnadd_samples_image_class_knnAddSamplesImageClassKnnAddSamplesImageClassKnn, create_class_knncreate_class_knnCreateClassKnncreate_class_knnCreateClassKnnCreateClassKnn

Module

Foundation


ClassesClassesClassesClasses | | | | Operators