write_class_knnT_write_class_knnWriteClassKnnWriteClassKnnwrite_class_knn (Operator)

Name

write_class_knnT_write_class_knnWriteClassKnnWriteClassKnnwrite_class_knn — Save the k-NN classifier in a file.

Signature

write_class_knn( : : KNNHandle, FileName : )

Herror T_write_class_knn(const Htuple KNNHandle, const Htuple FileName)

void WriteClassKnn(const HTuple& KNNHandle, const HTuple& FileName)

void HClassKnn::WriteClassKnn(const HString& FileName) const

void HClassKnn::WriteClassKnn(const char* FileName) const

void HClassKnn::WriteClassKnn(const wchar_t* FileName) const   (Windows only)

static void HOperatorSet.WriteClassKnn(HTuple KNNHandle, HTuple fileName)

void HClassKnn.WriteClassKnn(string fileName)

def write_class_knn(knnhandle: HHandle, file_name: str) -> None

Description

write_class_knnwrite_class_knnWriteClassKnnWriteClassKnnWriteClassKnnwrite_class_knn writes the k-NN classifier KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleknnhandle to the file given by FileNameFileNameFileNameFileNamefileNamefile_name. The classifier can be read again with read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnnread_class_knn. Since the samples are an intrinsic component of a k-NN-classifier, the operator write_class_knnwrite_class_knnWriteClassKnnWriteClassKnnWriteClassKnnwrite_class_knn saves them within the class file. In contrast to other classifiers like SVM, there is no operator for saving the samples separately. The samples can be retrieved from a k-NN-classifier using get_sample_class_knnget_sample_class_knnGetSampleClassKnnGetSampleClassKnnGetSampleClassKnnget_sample_class_knn. The default HALCON file extension for the k-NN classifier is 'gnc'.

Execution Information

Parameters

KNNHandleKNNHandleKNNHandleKNNHandleKNNHandleknnhandle (input_control)  class_knn HClassKnn, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the k-NN classifier.

FileNameFileNameFileNameFileNamefileNamefile_name (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the file in which the classifier will be written.

File extension: .gnc

Result

write_class_knnwrite_class_knnWriteClassKnnWriteClassKnnWriteClassKnnwrite_class_knn returns 2 (H_MSG_TRUE). An exception is raised if it was not possible to open file FileNameFileNameFileNameFileNamefileNamefile_name.

Possible Predecessors

train_class_knntrain_class_knnTrainClassKnnTrainClassKnnTrainClassKnntrain_class_knn, read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnnread_class_knn

See also

create_class_knncreate_class_knnCreateClassKnnCreateClassKnnCreateClassKnncreate_class_knn, read_class_knnread_class_knnReadClassKnnReadClassKnnReadClassKnnread_class_knn

References

Marius Muja, David G. Lowe: “Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration”; International Conference on Computer Vision Theory and Applications (VISAPP 09); 2009.

Module

Foundation