MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / saveClassificationResult

Method saveClassificationResult

ml/src/svm_wrapper.cpp:842–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842void
843pcl::SVMClassify::saveClassificationResult(const char* filename)
844{
845 assert(prediction_.size() > 0);
846 assert(model_.l > 0);
847
848 std::ofstream output;
849 output.open(filename);
850
851 int nr_class = svm_get_nr_class(&model_);
852 int* labels = static_cast<int*>(malloc(nr_class * sizeof(int)));
853 svm_get_labels(&model_, labels);
854
855 if (predict_probability_) {
856 output << "labels ";
857
858 for (int j = 0; j < nr_class; j++)
859 output << labels[j] << " ";
860
861 output << "\n";
862 }
863
864 for (const auto& prediction : prediction_) {
865 for (const double& value : prediction)
866 output << value << " ";
867
868 output << "\n";
869 }
870
871 output.close();
872
873 free(labels);
874}
875
876#define PCL_INSTANTIATE_SVM(T) template class PCL_EXPORTS pcl::SVM<T>;
877#define PCL_INSTANTIATE_SVMTrain(T) template class PCL_EXPORTS pcl::SVMTrain<T>;

Callers

nothing calls this directly

Calls 5

svm_get_nr_classFunction · 0.85
svm_get_labelsFunction · 0.85
sizeMethod · 0.45
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected