Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
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
#include <cstring>
26
#include <cstdlib>
27
28
namespace
firevision
{
29
#if 0
/* just to make Emacs auto-indent happy */
30
}
31
#endif
32
33
/** @class Classifier <fvclassifiers/classifier.h>
34
* Classifier to extract regions of interest.
35
* The classifier finds regions of interest (ROI) by some a priori knowledge
36
* like known colors or shapes. The list of ROIs returned by classify() _must_
37
* be disjunct, meaning that no ROIs overlap each other.
38
* Do appropriate merging or shrinking of the ROIs. See the ReallySimpleClassifier
39
* for an example.
40
* @author Tim Niemueller
41
*
42
* @fn std::list< ROI > * Classifier::classify() = 0
43
* Classify image.
44
* The current buffer is processed and scanned for the features the classifier
45
* has been written and initialized for. It returns a list of disjunct regions
46
* of interest.
47
* @return disjunct list of extracted regions of interest
48
*/
49
50
51
/** Constructor.
52
* @param name classifier name
53
*/
54
Classifier::Classifier(
const
char
*name)
55
{
56
__name = strdup(name);
57
_src = NULL;
58
_width = 0;
59
_height = 0;
60
}
61
62
63
/** Destructor. */
64
Classifier::~Classifier()
65
{
66
free(__name);
67
}
68
69
70
/** Set source buffer.
71
* @param yuv422_planar a YUV422 planar buffer with the source image to
72
* classify. The classifier may NOT modify the image in any way. If that is
73
* required the classifier shall make a copy of the image.
74
* @param width width of buffer in pixels
75
* @param height height of buffer in pixels
76
*/
77
void
78
Classifier::set_src_buffer(
unsigned
char
*yuv422_planar,
unsigned
int
width,
79
unsigned
int
height)
80
{
81
_src = yuv422_planar;
82
_width = width;
83
_height = height;
84
}
85
86
87
/** Get name of classifier.
88
* @return name of classifier.
89
*/
90
const
char
*
91
Classifier::name()
const
92
{
93
return
__name;
94
}
95
96
}
// end namespace firevision
firevision
Definition:
vision_master.h:32
src
libs
fvclassifiers
classifier.cpp
Generated by
1.8.9.1