ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
classifier.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "ccPointDescriptor.h"
12 
13 // cloudViewer
14 #include <CVGeom.h>
15 
16 // Qt
17 #include <QString>
18 
19 // system
20 #include <vector>
21 
23 class Classifier {
24 public: // methods
27 
29  Classifier();
30 
32 
35  bool checkRefPoints();
36 
38  float classify2D_checkcondnum(const Point2D& P,
39  const Point2D& R,
40  float& condnumber) const;
41 
43  float classify2D(const Point2D& P) const;
44 
46  Point2D project(const CorePointDesc& mscdata) const;
47 
49  float classify(const CorePointDesc& mscdata) const;
50 
52  struct FileHeader {
53  unsigned classifierCount;
54  unsigned dimPerScale;
55  unsigned descID;
56  };
57 
59  static bool Load(QString filename,
60  std::vector<Classifier>& classifiers,
61  std::vector<float>& scales,
62  QString& error,
63  FileHeader* header = 0,
64  bool headerOnly = false);
65 
67  bool save(QString filename, QString& error);
68 
69 public: // members
70  int class1, class2;
71  std::vector<float> weightsAxis1, weightsAxis2;
72  std::vector<Point2D> path;
75 
77  unsigned descriptorID;
78 
80  unsigned dimPerScale;
81 
83  std::vector<float> scales;
84 };
std::string filename
Classifier.
Definition: classifier.h:23
float absMaxXY
Definition: classifier.h:73
std::vector< float > weightsAxis2
Definition: classifier.h:71
static bool Load(QString filename, std::vector< Classifier > &classifiers, std::vector< float > &scales, QString &error, FileHeader *header=0, bool headerOnly=false)
Loads a CANUPO's classifier file (.prm)
Definition: classifier.cpp:157
float classify2D(const Point2D &P) const
Classification in the 2D space.
Definition: classifier.cpp:119
float classify2D_checkcondnum(const Point2D &P, const Point2D &R, float &condnumber) const
Checks numerical condition.
Definition: classifier.cpp:34
bool save(QString filename, QString &error)
Saves classifier as a CANUPO's classifier file (.prm)
Definition: classifier.cpp:299
float axisScaleRatio
Definition: classifier.h:73
unsigned dimPerScale
Dimension (per-scale)
Definition: classifier.h:80
int class1
Definition: classifier.h:70
Point2D project(const CorePointDesc &mscdata) const
Projects a parameter vector in (2D) MSC space.
Definition: classifier.cpp:129
unsigned descriptorID
Associated descriptor ID (see ccPointDescriptor.h)
Definition: classifier.h:77
Vector2Tpl< float > Point2D
2D point
Definition: classifier.h:26
std::vector< float > weightsAxis1
Definition: classifier.h:71
std::vector< Point2D > path
Definition: classifier.h:72
std::vector< float > scales
Associated scales.
Definition: classifier.h:83
float classify(const CorePointDesc &mscdata) const
Classification in MSC space.
Definition: classifier.cpp:152
bool checkRefPoints()
Checks the ref. points.
Definition: classifier.cpp:25
Point2D refPointPos
Definition: classifier.h:74
int class2
Definition: classifier.h:70
Classifier()
Default constructor.
Definition: classifier.cpp:17
Point2D refPointNeg
Definition: classifier.h:74
static void error(char *msg)
Definition: lsd.c:159
Classifier's file header info.
Definition: classifier.h:52
unsigned classifierCount
Definition: classifier.h:53
Set of descriptors.