File: gamera.hpp

package info (click to toggle)
gamera 1%3A3.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,912 kB
  • sloc: xml: 122,324; cpp: 50,730; python: 35,044; ansic: 258; makefile: 114; sh: 101
file content (199 lines) | stat: -rw-r--r-- 5,344 bytes parent folder | download | duplicates (4)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
 *
 * Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom, and Karl MacMillan
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef kwm01032002_gamera_hpp
#define kwm01032002_gamera_hpp

/*
  The bulk of gamera is in the following includes - this file is simply for
  convenience.
 */

/* 
  Deprecation of functions 
  This stuff handles the deprecation of certain method
  signatures from Gamera 2.x - 3.x.

  Unfortunately this stuff only works on gcc, and not on mingw gcc.
*/
#if GAMERA_INCLUDE_DEPRECATED == 1
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define GAMERA_CPP_DEPRECATED \
 __attribute__((__deprecated__))
#else
#define GAMERA_CPP_DEPRECATED
#endif /* __GNUC__ */
#define GAMERA_DEPRECATED
#undef GAMERA_NO_DEPRECATED
#else /* GAMERA_INCLUDE_DEPRECATED */
#define GAMERA_CPP_DEPRECATED
#define GAMERA_NO_DEPRECATED
#undef GAMERA_DEPRECATED
#endif /* GAMERA_INCLUDE_DEPRECATED */

#include <vector>
#include <list>

#include "pixel.hpp"
#include "dimensions.hpp"
#include "floatpoint.hpp"
#include "image_info.hpp"
#include "image_algorithm.hpp"
#include "utility.hpp"
#include "image_view.hpp"
#include "connected_components.hpp"
#include "image_data.hpp"
#include "rle_data.hpp"
#include "image.hpp"
#include "region.hpp"
#include "static_image.hpp"
#include "vigra_support.hpp"
#include "image_types.hpp"
#include "accessor.hpp"

namespace Gamera {

  /*
   * This file contains a few typedefs to make standard classes
   * easier to use.
   */

  /***********************************************************
   * FEATURES
   ***********************************************************/

  /**
   * Image feature type.
   *
   * The feature_t is a typedef for a floating point type
   * used for all of the feature calculation functions
   * in Gamera.
   */
  typedef double feature_t;

  /**
   * Floating-point vector.
   *
   * The Gamera::FloatVector type is used to pass arrays of
   * floating-point data. Each element is of type feature_t
   * and the container is a std::vector.
   */
  typedef std::vector<feature_t> FloatVector;

  /***********************************************************
   * UTILITY
   ***********************************************************/

  /**
   * String Vector.
   *
   * The Gamera::StringVectors is a std::vector of std::strings.
   */
  typedef std::vector<std::string> StringVector;

  /**
   * ImageVector Vector.
   *
   * The Gamera::ImageVectors is a std::vector of pairs of Image* and image type codes.
   */
  typedef std::vector<std::pair<Image*, int> > ImageVector;
  typedef std::list<Image*> ImageList;

  /**
   * Int Vector.
   *
   * The Gamera::IntVector type is used to pass arrays of
   * integers types. The container is a std::vector.
   */
  typedef std::vector<int> IntVector;

  /**
   * SignedIntVector
   *
   * The Gamera::SignedIntVector type is used to pass arrays
   * of signed integer types. In previous versions this was
   * different from Gamera::IntVectors, which held unsigned
   * types. Currently, however, IntVector and SignedIntVector
   * are the same.
   */
  typedef std::vector<int> SignedIntVector;

  /**
   * ComplexVector
   *
   * The Gamera::ComplexVector type is used to pass arrays
   * of the complex type.
   */
  typedef std::vector<ComplexPixel> ComplexVector;

  /**
   * Region
   *
   * The Gamera::Region type is used to associate a rectangular
   * areas on an image with a set of values. These values are stored
   * as key/value pairs (string/double). See RegionTemplate for more
   * information.
   */
  typedef RegionTemplate<double> Region;

  /**
   * Region Map
   *
   * The Gamera::RegionMap type is a list of regions. Regions can be
   * added to the list and searched for by position.
   */
  typedef RegionMapTemplate<double> RegionMap;

  /**
   * Colors
   *
   * Gamera::color_set is a standard set of colors for use whenever
   * colors need to be applied to an image. By limiting the size to
   * eight it makes it easy to pick an arbitrary color by bitwise
   * operators on pixels.
   */
  static const int COLOR_SET_SIZE = 8;
  const unsigned char color_set[COLOR_SET_SIZE][3] = {
    {0xbc, 0x2d, 0x2d}, // Red
    {0xb4, 0x2d, 0xbc}, // Magenta
    {0x2d, 0x34, 0xbc}, // Blue
    {0x2d, 0xbc, 0xb7}, // Cyan
    {0x3a, 0xbc, 0x2d}, // Green
    {0xbc, 0xb7, 0x2d}, // Yellow
    {0xbc, 0x88, 0x2d}, // Orange
    {0x6e, 0x00, 0xc7}  // Purple
  };

  /**
   * Point Vector
   *
   * For managing lists of points
   */
  typedef std::vector<Point> PointVector;

  template<class T>
  static inline T sign(const T& x) {
    return ((x) > 0 ? 1 : (x) < 0 ? -1 : 0);
  }
  
}


#endif