Fawkes API
Fawkes Development Version
classifier.cpp
1
2
/***************************************************************************
3
* classifier.cpp - Abstract class defining a classifier
4
*
5
* Created: Mon Dec 10 11:35:36 2007
6
* Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <fvclassifiers/classifier.h>
25
26
#include <cstdlib>
27
#include <cstring>
28
29
namespace
firevision {
30
31
/** @class Classifier <fvclassifiers/classifier.h>
32
* Classifier to extract regions of interest.
33
* The classifier finds regions of interest (ROI) by some a priori knowledge
34
* like known colors or shapes. The list of ROIs returned by classify() _must_
35
* be disjunct, meaning that no ROIs overlap each other.
36
* Do appropriate merging or shrinking of the ROIs. See the ReallySimpleClassifier
37
* for an example.
38
* @author Tim Niemueller
39
*
40
* @fn std::list< ROI > * Classifier::classify() = 0
41
* Classify image.
42
* The current buffer is processed and scanned for the features the classifier
43
* has been written and initialized for. It returns a list of disjunct regions
44
* of interest.
45
* @return disjunct list of extracted regions of interest
46
*/
47
48
/** Constructor.
49
* @param name classifier name
50
*/
51
Classifier::Classifier
(
const
char
*name)
52
{
53
name_ = strdup(
name
);
54
_src
= NULL;
55
_width
= 0;
56
_height
= 0;
57
}
58
59
/** Destructor. */
60
Classifier::~Classifier
()
61
{
62
free(name_);
63
}
64
65
/** Set source buffer.
66
* @param yuv422_planar a YUV422 planar buffer with the source image to
67
* classify. The classifier may NOT modify the image in any way. If that is
68
* required the classifier shall make a copy of the image.
69
* @param width width of buffer in pixels
70
* @param height height of buffer in pixels
71
*/
72
void
73
Classifier::set_src_buffer
(
unsigned
char
*yuv422_planar,
unsigned
int
width,
unsigned
int
height)
74
{
75
_src
= yuv422_planar;
76
_width
= width;
77
_height
= height;
78
}
79
80
/** Get name of classifier.
81
* @return name of classifier.
82
*/
83
const
char
*
84
Classifier::name
()
const
85
{
86
return
name_;
87
}
88
89
}
// end namespace firevision
firevision::Classifier::~Classifier
virtual ~Classifier()
Destructor.
Definition:
classifier.cpp:64
firevision::Classifier::_height
unsigned int _height
Height in pixels of _src buffer.
Definition:
classifier.h:57
firevision::Classifier::_width
unsigned int _width
Width in pixels of _src buffer.
Definition:
classifier.h:55
firevision::Classifier::Classifier
Classifier(const char *name)
Constructor.
Definition:
classifier.cpp:55
firevision::Classifier::_src
unsigned char * _src
Source buffer, encoded as YUV422_PLANAR.
Definition:
classifier.h:53
firevision::Classifier::set_src_buffer
virtual void set_src_buffer(unsigned char *yuv422_planar, unsigned int width, unsigned int height)
Set source buffer.
Definition:
classifier.cpp:77
firevision::Classifier::name
virtual const char * name() const
Get name of classifier.
Definition:
classifier.cpp:88
src
libs
fvclassifiers
classifier.cpp
Generated by
1.8.16