| 840 | } |
| 841 | |
| 842 | void |
| 843 | pcl::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>; |
nothing calls this directly
no test coverage detected