Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
square_shrinker.cpp
1
2
/***************************************************************************
3
* square_shrinker.cpp - Implementation of SquareShrinker
4
*
5
* Created: Tue Apr 22 2008 20:58:40 (GO2008, day 4)
6
* Copyright 2005-2008 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/square_shrinker.h>
25
26
#include <fvutils/color/colorspaces.h>
27
#include <fvutils/base/roi.h>
28
29
#include <fvmodels/scanlines/scanlinemodel.h>
30
#include <fvmodels/color/colormodel.h>
31
32
#include <cstddef>
33
34
namespace
firevision {
35
#if 0
/* just to make Emacs auto-indent happy */
36
}
37
#endif
38
39
/** @class SquareShrinker <fvclassifiers/square_shrinker.h>
40
* Square shrinker.
41
* This shrinker makes sure that a ROI is always squared.
42
* @author Tim Niemueller
43
*/
44
45
/** Constructor. */
46
SquareShrinker::SquareShrinker()
47
:
Shrinker
()
48
{
49
}
50
51
52
/** Shrink!
53
* Do the actual shrinking.
54
* @param roi ROI to shrink
55
*/
56
void
57
SquareShrinker::shrink
(
ROI
*roi )
58
{
59
if
( roi->
width
< roi->
height
) {
60
roi->
start
.
y
+= (roi->
height
- roi->
width
) / 2;
61
roi->
height
= roi->
width
;
62
}
else
if
( roi->
width
> roi->
height
) {
63
roi->
start
.
x
+= (roi->
width
- roi->
height
) / 2;
64
roi->
width
= roi->
height
;
65
}
66
}
67
68
}
// end namespace firevision
src
libs
fvclassifiers
square_shrinker.cpp
Generated by
1.8.3.1