Skip to content

write_class_knnWriteClassKnnWriteClassKnnwrite_class_knnT_write_class_knnπŸ”—

Short descriptionπŸ”—

write_class_knnWriteClassKnnWriteClassKnnwrite_class_knnT_write_class_knn β€” Save the k-NN classifier in a file.

SignatureπŸ”—

write_class_knn( class_knn KNNHandle, filename.write FileName )void WriteClassKnn( const HTuple& KNNHandle, const HTuple& FileName )static void HOperatorSet.WriteClassKnn( HTuple KNNHandle, HTuple fileName )def write_class_knn( knnhandle: HHandle, file_name: str ) -> None

Herror T_write_class_knn( 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)

void HClassKnn.WriteClassKnn( string fileName )

DescriptionπŸ”—

write_class_knnWriteClassKnn writes the k-NN classifier KNNHandleKNNHandleknnhandle to the file given by FileNamefileNamefile_name. The classifier can be read again with read_class_knnReadClassKnn. Since the samples are an intrinsic component of a k-NN-classifier, the operator write_class_knnWriteClassKnn 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_knnGetSampleClassKnn. The default HALCON file extension for the k-NN classifier is 'gnc'.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

KNNHandleKNNHandleknnhandle (input_control) class_knn β†’ (handle)HTuple (HHandle)HClassKnn, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the k-NN classifier.

FileNamefileNamefile_name (input_control) filename.write β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

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

File extension: .gnc

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

train_class_knnTrainClassKnn, read_class_knnReadClassKnn

See also

create_class_knnCreateClassKnn, read_class_knnReadClassKnn

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