-
Notifications
You must be signed in to change notification settings - Fork 0
/
labeling.h
executable file
·79 lines (59 loc) · 2.23 KB
/
labeling.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Copyright 2015-2020 Julien Mille
This file is part of the PixelLabeling source code package.
PixelLabeling is free software: you can redistribute
it and/or modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
PixelLabeling is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
You should have received a copy of the GNU General Public License,
and a copy of the GNU Lesser General Public License, along with
PixelLabeling. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LABELING_H
#define LABELING_H
#include <string>
#include <vector>
#include <opencv2/core.hpp>
class CLabelClassProperties
{
public:
std::string className;
cv::Vec3b rgbClassColor;
public:
CLabelClassProperties() {}
};
class Labeling : public cv::Mat
{
// Static members
public:
static std::vector<CLabelClassProperties> vectClassesProperties;
// Static member functions
public:
// Initialize class properties (names and colors) by parsing file 'classes_config.txt'
static void InitClassesProperties();
public:
Labeling() {}
// Create an empty labeling with given size
// Labels are stored on unsigned chars (0 = unlabeled)
void Create(const cv::Size &);
// Get or set the label of a given pixel
void SetLabel(const cv::Point &, unsigned int);
unsigned int GetLabel(const cv::Point &) const;
// Change labels in a disk
// Params : center, radius, base label, target label
// boolean indicating if target label should replace all current labels (base label is ignored)
void SetLabelDisk(const cv::Point &, unsigned int, unsigned int, unsigned int, bool bReplaceAll=false);
// Unlabel all pixels of a given class
virtual void EmptyClass(unsigned int);
// Unlabel all pixels
void Empty();
bool IsEmpty() const;
void MakeLabelImage(cv::Mat &) const;
void MakeLabelImageRGB(cv::Mat &) const;
void InitFromLabelImage(const cv::Mat &);
};
#endif