Joe Verbout
/
main
opencv on mbed
opencv2/core/traits.hpp@0:ea44dc9ed014, 2016-03-31 (annotated)
- Committer:
- joeverbout
- Date:
- Thu Mar 31 21:16:38 2016 +0000
- Revision:
- 0:ea44dc9ed014
OpenCV on mbed attempt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeverbout | 0:ea44dc9ed014 | 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// |
joeverbout | 0:ea44dc9ed014 | 2 | // |
joeverbout | 0:ea44dc9ed014 | 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
joeverbout | 0:ea44dc9ed014 | 4 | // |
joeverbout | 0:ea44dc9ed014 | 5 | // By downloading, copying, installing or using the software you agree to this license. |
joeverbout | 0:ea44dc9ed014 | 6 | // If you do not agree to this license, do not download, install, |
joeverbout | 0:ea44dc9ed014 | 7 | // copy or use the software. |
joeverbout | 0:ea44dc9ed014 | 8 | // |
joeverbout | 0:ea44dc9ed014 | 9 | // |
joeverbout | 0:ea44dc9ed014 | 10 | // License Agreement |
joeverbout | 0:ea44dc9ed014 | 11 | // For Open Source Computer Vision Library |
joeverbout | 0:ea44dc9ed014 | 12 | // |
joeverbout | 0:ea44dc9ed014 | 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 16 | // Third party copyrights are property of their respective owners. |
joeverbout | 0:ea44dc9ed014 | 17 | // |
joeverbout | 0:ea44dc9ed014 | 18 | // Redistribution and use in source and binary forms, with or without modification, |
joeverbout | 0:ea44dc9ed014 | 19 | // are permitted provided that the following conditions are met: |
joeverbout | 0:ea44dc9ed014 | 20 | // |
joeverbout | 0:ea44dc9ed014 | 21 | // * Redistribution's of source code must retain the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 22 | // this list of conditions and the following disclaimer. |
joeverbout | 0:ea44dc9ed014 | 23 | // |
joeverbout | 0:ea44dc9ed014 | 24 | // * Redistribution's in binary form must reproduce the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 25 | // this list of conditions and the following disclaimer in the documentation |
joeverbout | 0:ea44dc9ed014 | 26 | // and/or other materials provided with the distribution. |
joeverbout | 0:ea44dc9ed014 | 27 | // |
joeverbout | 0:ea44dc9ed014 | 28 | // * The name of the copyright holders may not be used to endorse or promote products |
joeverbout | 0:ea44dc9ed014 | 29 | // derived from this software without specific prior written permission. |
joeverbout | 0:ea44dc9ed014 | 30 | // |
joeverbout | 0:ea44dc9ed014 | 31 | // This software is provided by the copyright holders and contributors "as is" and |
joeverbout | 0:ea44dc9ed014 | 32 | // any express or implied warranties, including, but not limited to, the implied |
joeverbout | 0:ea44dc9ed014 | 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. |
joeverbout | 0:ea44dc9ed014 | 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, |
joeverbout | 0:ea44dc9ed014 | 35 | // indirect, incidental, special, exemplary, or consequential damages |
joeverbout | 0:ea44dc9ed014 | 36 | // (including, but not limited to, procurement of substitute goods or services; |
joeverbout | 0:ea44dc9ed014 | 37 | // loss of use, data, or profits; or business interruption) however caused |
joeverbout | 0:ea44dc9ed014 | 38 | // and on any theory of liability, whether in contract, strict liability, |
joeverbout | 0:ea44dc9ed014 | 39 | // or tort (including negligence or otherwise) arising in any way out of |
joeverbout | 0:ea44dc9ed014 | 40 | // the use of this software, even if advised of the possibility of such damage. |
joeverbout | 0:ea44dc9ed014 | 41 | // |
joeverbout | 0:ea44dc9ed014 | 42 | //M*/ |
joeverbout | 0:ea44dc9ed014 | 43 | |
joeverbout | 0:ea44dc9ed014 | 44 | #ifndef __OPENCV_CORE_TRAITS_HPP__ |
joeverbout | 0:ea44dc9ed014 | 45 | #define __OPENCV_CORE_TRAITS_HPP__ |
joeverbout | 0:ea44dc9ed014 | 46 | |
joeverbout | 0:ea44dc9ed014 | 47 | #include "opencv2/core/cvdef.h" |
joeverbout | 0:ea44dc9ed014 | 48 | |
joeverbout | 0:ea44dc9ed014 | 49 | namespace cv |
joeverbout | 0:ea44dc9ed014 | 50 | { |
joeverbout | 0:ea44dc9ed014 | 51 | |
joeverbout | 0:ea44dc9ed014 | 52 | //! @addtogroup core_basic |
joeverbout | 0:ea44dc9ed014 | 53 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 54 | |
joeverbout | 0:ea44dc9ed014 | 55 | /** @brief Template "trait" class for OpenCV primitive data types. |
joeverbout | 0:ea44dc9ed014 | 56 | |
joeverbout | 0:ea44dc9ed014 | 57 | A primitive OpenCV data type is one of unsigned char, bool, signed char, unsigned short, signed |
joeverbout | 0:ea44dc9ed014 | 58 | short, int, float, double, or a tuple of values of one of these types, where all the values in the |
joeverbout | 0:ea44dc9ed014 | 59 | tuple have the same type. Any primitive type from the list can be defined by an identifier in the |
joeverbout | 0:ea44dc9ed014 | 60 | form CV_\<bit-depth\>{U|S|F}C(\<number_of_channels\>), for example: uchar \~ CV_8UC1, 3-element |
joeverbout | 0:ea44dc9ed014 | 61 | floating-point tuple \~ CV_32FC3, and so on. A universal OpenCV structure that is able to store a |
joeverbout | 0:ea44dc9ed014 | 62 | single instance of such a primitive data type is Vec. Multiple instances of such a type can be |
joeverbout | 0:ea44dc9ed014 | 63 | stored in a std::vector, Mat, Mat_, SparseMat, SparseMat_, or any other container that is able to |
joeverbout | 0:ea44dc9ed014 | 64 | store Vec instances. |
joeverbout | 0:ea44dc9ed014 | 65 | |
joeverbout | 0:ea44dc9ed014 | 66 | The DataType class is basically used to provide a description of such primitive data types without |
joeverbout | 0:ea44dc9ed014 | 67 | adding any fields or methods to the corresponding classes (and it is actually impossible to add |
joeverbout | 0:ea44dc9ed014 | 68 | anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not |
joeverbout | 0:ea44dc9ed014 | 69 | DataType itself that is used but its specialized versions, such as: |
joeverbout | 0:ea44dc9ed014 | 70 | @code |
joeverbout | 0:ea44dc9ed014 | 71 | template<> class DataType<uchar> |
joeverbout | 0:ea44dc9ed014 | 72 | { |
joeverbout | 0:ea44dc9ed014 | 73 | typedef uchar value_type; |
joeverbout | 0:ea44dc9ed014 | 74 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 75 | typedef uchar channel_type; |
joeverbout | 0:ea44dc9ed014 | 76 | enum { channel_type = CV_8U, channels = 1, fmt='u', type = CV_8U }; |
joeverbout | 0:ea44dc9ed014 | 77 | }; |
joeverbout | 0:ea44dc9ed014 | 78 | ... |
joeverbout | 0:ea44dc9ed014 | 79 | template<typename _Tp> DataType<std::complex<_Tp> > |
joeverbout | 0:ea44dc9ed014 | 80 | { |
joeverbout | 0:ea44dc9ed014 | 81 | typedef std::complex<_Tp> value_type; |
joeverbout | 0:ea44dc9ed014 | 82 | typedef std::complex<_Tp> work_type; |
joeverbout | 0:ea44dc9ed014 | 83 | typedef _Tp channel_type; |
joeverbout | 0:ea44dc9ed014 | 84 | // DataDepth is another helper trait class |
joeverbout | 0:ea44dc9ed014 | 85 | enum { depth = DataDepth<_Tp>::value, channels=2, |
joeverbout | 0:ea44dc9ed014 | 86 | fmt=(channels-1)*256+DataDepth<_Tp>::fmt, |
joeverbout | 0:ea44dc9ed014 | 87 | type=CV_MAKETYPE(depth, channels) }; |
joeverbout | 0:ea44dc9ed014 | 88 | }; |
joeverbout | 0:ea44dc9ed014 | 89 | ... |
joeverbout | 0:ea44dc9ed014 | 90 | @endcode |
joeverbout | 0:ea44dc9ed014 | 91 | The main purpose of this class is to convert compilation-time type information to an |
joeverbout | 0:ea44dc9ed014 | 92 | OpenCV-compatible data type identifier, for example: |
joeverbout | 0:ea44dc9ed014 | 93 | @code |
joeverbout | 0:ea44dc9ed014 | 94 | // allocates a 30x40 floating-point matrix |
joeverbout | 0:ea44dc9ed014 | 95 | Mat A(30, 40, DataType<float>::type); |
joeverbout | 0:ea44dc9ed014 | 96 | |
joeverbout | 0:ea44dc9ed014 | 97 | Mat B = Mat_<std::complex<double> >(3, 3); |
joeverbout | 0:ea44dc9ed014 | 98 | // the statement below will print 6, 2 , that is depth == CV_64F, channels == 2 |
joeverbout | 0:ea44dc9ed014 | 99 | cout << B.depth() << ", " << B.channels() << endl; |
joeverbout | 0:ea44dc9ed014 | 100 | @endcode |
joeverbout | 0:ea44dc9ed014 | 101 | So, such traits are used to tell OpenCV which data type you are working with, even if such a type is |
joeverbout | 0:ea44dc9ed014 | 102 | not native to OpenCV. For example, the matrix B initialization above is compiled because OpenCV |
joeverbout | 0:ea44dc9ed014 | 103 | defines the proper specialized template class DataType\<complex\<_Tp\> \> . This mechanism is also |
joeverbout | 0:ea44dc9ed014 | 104 | useful (and used in OpenCV this way) for generic algorithms implementations. |
joeverbout | 0:ea44dc9ed014 | 105 | */ |
joeverbout | 0:ea44dc9ed014 | 106 | template<typename _Tp> class DataType |
joeverbout | 0:ea44dc9ed014 | 107 | { |
joeverbout | 0:ea44dc9ed014 | 108 | public: |
joeverbout | 0:ea44dc9ed014 | 109 | typedef _Tp value_type; |
joeverbout | 0:ea44dc9ed014 | 110 | typedef value_type work_type; |
joeverbout | 0:ea44dc9ed014 | 111 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 112 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 113 | enum { generic_type = 1, |
joeverbout | 0:ea44dc9ed014 | 114 | depth = -1, |
joeverbout | 0:ea44dc9ed014 | 115 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 116 | fmt = 0, |
joeverbout | 0:ea44dc9ed014 | 117 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 118 | }; |
joeverbout | 0:ea44dc9ed014 | 119 | }; |
joeverbout | 0:ea44dc9ed014 | 120 | |
joeverbout | 0:ea44dc9ed014 | 121 | template<> class DataType<bool> |
joeverbout | 0:ea44dc9ed014 | 122 | { |
joeverbout | 0:ea44dc9ed014 | 123 | public: |
joeverbout | 0:ea44dc9ed014 | 124 | typedef bool value_type; |
joeverbout | 0:ea44dc9ed014 | 125 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 126 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 127 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 128 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 129 | depth = CV_8U, |
joeverbout | 0:ea44dc9ed014 | 130 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 131 | fmt = (int)'u', |
joeverbout | 0:ea44dc9ed014 | 132 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 133 | }; |
joeverbout | 0:ea44dc9ed014 | 134 | }; |
joeverbout | 0:ea44dc9ed014 | 135 | |
joeverbout | 0:ea44dc9ed014 | 136 | template<> class DataType<uchar> |
joeverbout | 0:ea44dc9ed014 | 137 | { |
joeverbout | 0:ea44dc9ed014 | 138 | public: |
joeverbout | 0:ea44dc9ed014 | 139 | typedef uchar value_type; |
joeverbout | 0:ea44dc9ed014 | 140 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 141 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 142 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 143 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 144 | depth = CV_8U, |
joeverbout | 0:ea44dc9ed014 | 145 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 146 | fmt = (int)'u', |
joeverbout | 0:ea44dc9ed014 | 147 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 148 | }; |
joeverbout | 0:ea44dc9ed014 | 149 | }; |
joeverbout | 0:ea44dc9ed014 | 150 | |
joeverbout | 0:ea44dc9ed014 | 151 | template<> class DataType<schar> |
joeverbout | 0:ea44dc9ed014 | 152 | { |
joeverbout | 0:ea44dc9ed014 | 153 | public: |
joeverbout | 0:ea44dc9ed014 | 154 | typedef schar value_type; |
joeverbout | 0:ea44dc9ed014 | 155 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 156 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 157 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 158 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 159 | depth = CV_8S, |
joeverbout | 0:ea44dc9ed014 | 160 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 161 | fmt = (int)'c', |
joeverbout | 0:ea44dc9ed014 | 162 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 163 | }; |
joeverbout | 0:ea44dc9ed014 | 164 | }; |
joeverbout | 0:ea44dc9ed014 | 165 | |
joeverbout | 0:ea44dc9ed014 | 166 | template<> class DataType<char> |
joeverbout | 0:ea44dc9ed014 | 167 | { |
joeverbout | 0:ea44dc9ed014 | 168 | public: |
joeverbout | 0:ea44dc9ed014 | 169 | typedef schar value_type; |
joeverbout | 0:ea44dc9ed014 | 170 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 171 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 172 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 173 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 174 | depth = CV_8S, |
joeverbout | 0:ea44dc9ed014 | 175 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 176 | fmt = (int)'c', |
joeverbout | 0:ea44dc9ed014 | 177 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 178 | }; |
joeverbout | 0:ea44dc9ed014 | 179 | }; |
joeverbout | 0:ea44dc9ed014 | 180 | |
joeverbout | 0:ea44dc9ed014 | 181 | template<> class DataType<ushort> |
joeverbout | 0:ea44dc9ed014 | 182 | { |
joeverbout | 0:ea44dc9ed014 | 183 | public: |
joeverbout | 0:ea44dc9ed014 | 184 | typedef ushort value_type; |
joeverbout | 0:ea44dc9ed014 | 185 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 186 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 187 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 188 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 189 | depth = CV_16U, |
joeverbout | 0:ea44dc9ed014 | 190 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 191 | fmt = (int)'w', |
joeverbout | 0:ea44dc9ed014 | 192 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 193 | }; |
joeverbout | 0:ea44dc9ed014 | 194 | }; |
joeverbout | 0:ea44dc9ed014 | 195 | |
joeverbout | 0:ea44dc9ed014 | 196 | template<> class DataType<short> |
joeverbout | 0:ea44dc9ed014 | 197 | { |
joeverbout | 0:ea44dc9ed014 | 198 | public: |
joeverbout | 0:ea44dc9ed014 | 199 | typedef short value_type; |
joeverbout | 0:ea44dc9ed014 | 200 | typedef int work_type; |
joeverbout | 0:ea44dc9ed014 | 201 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 202 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 203 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 204 | depth = CV_16S, |
joeverbout | 0:ea44dc9ed014 | 205 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 206 | fmt = (int)'s', |
joeverbout | 0:ea44dc9ed014 | 207 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 208 | }; |
joeverbout | 0:ea44dc9ed014 | 209 | }; |
joeverbout | 0:ea44dc9ed014 | 210 | |
joeverbout | 0:ea44dc9ed014 | 211 | template<> class DataType<int> |
joeverbout | 0:ea44dc9ed014 | 212 | { |
joeverbout | 0:ea44dc9ed014 | 213 | public: |
joeverbout | 0:ea44dc9ed014 | 214 | typedef int value_type; |
joeverbout | 0:ea44dc9ed014 | 215 | typedef value_type work_type; |
joeverbout | 0:ea44dc9ed014 | 216 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 217 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 218 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 219 | depth = CV_32S, |
joeverbout | 0:ea44dc9ed014 | 220 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 221 | fmt = (int)'i', |
joeverbout | 0:ea44dc9ed014 | 222 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 223 | }; |
joeverbout | 0:ea44dc9ed014 | 224 | }; |
joeverbout | 0:ea44dc9ed014 | 225 | |
joeverbout | 0:ea44dc9ed014 | 226 | template<> class DataType<float> |
joeverbout | 0:ea44dc9ed014 | 227 | { |
joeverbout | 0:ea44dc9ed014 | 228 | public: |
joeverbout | 0:ea44dc9ed014 | 229 | typedef float value_type; |
joeverbout | 0:ea44dc9ed014 | 230 | typedef value_type work_type; |
joeverbout | 0:ea44dc9ed014 | 231 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 232 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 233 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 234 | depth = CV_32F, |
joeverbout | 0:ea44dc9ed014 | 235 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 236 | fmt = (int)'f', |
joeverbout | 0:ea44dc9ed014 | 237 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 238 | }; |
joeverbout | 0:ea44dc9ed014 | 239 | }; |
joeverbout | 0:ea44dc9ed014 | 240 | |
joeverbout | 0:ea44dc9ed014 | 241 | template<> class DataType<double> |
joeverbout | 0:ea44dc9ed014 | 242 | { |
joeverbout | 0:ea44dc9ed014 | 243 | public: |
joeverbout | 0:ea44dc9ed014 | 244 | typedef double value_type; |
joeverbout | 0:ea44dc9ed014 | 245 | typedef value_type work_type; |
joeverbout | 0:ea44dc9ed014 | 246 | typedef value_type channel_type; |
joeverbout | 0:ea44dc9ed014 | 247 | typedef value_type vec_type; |
joeverbout | 0:ea44dc9ed014 | 248 | enum { generic_type = 0, |
joeverbout | 0:ea44dc9ed014 | 249 | depth = CV_64F, |
joeverbout | 0:ea44dc9ed014 | 250 | channels = 1, |
joeverbout | 0:ea44dc9ed014 | 251 | fmt = (int)'d', |
joeverbout | 0:ea44dc9ed014 | 252 | type = CV_MAKETYPE(depth, channels) |
joeverbout | 0:ea44dc9ed014 | 253 | }; |
joeverbout | 0:ea44dc9ed014 | 254 | }; |
joeverbout | 0:ea44dc9ed014 | 255 | |
joeverbout | 0:ea44dc9ed014 | 256 | |
joeverbout | 0:ea44dc9ed014 | 257 | /** @brief A helper class for cv::DataType |
joeverbout | 0:ea44dc9ed014 | 258 | |
joeverbout | 0:ea44dc9ed014 | 259 | The class is specialized for each fundamental numerical data type supported by OpenCV. It provides |
joeverbout | 0:ea44dc9ed014 | 260 | DataDepth<T>::value constant. |
joeverbout | 0:ea44dc9ed014 | 261 | */ |
joeverbout | 0:ea44dc9ed014 | 262 | template<typename _Tp> class DataDepth |
joeverbout | 0:ea44dc9ed014 | 263 | { |
joeverbout | 0:ea44dc9ed014 | 264 | public: |
joeverbout | 0:ea44dc9ed014 | 265 | enum |
joeverbout | 0:ea44dc9ed014 | 266 | { |
joeverbout | 0:ea44dc9ed014 | 267 | value = DataType<_Tp>::depth, |
joeverbout | 0:ea44dc9ed014 | 268 | fmt = DataType<_Tp>::fmt |
joeverbout | 0:ea44dc9ed014 | 269 | }; |
joeverbout | 0:ea44dc9ed014 | 270 | }; |
joeverbout | 0:ea44dc9ed014 | 271 | |
joeverbout | 0:ea44dc9ed014 | 272 | |
joeverbout | 0:ea44dc9ed014 | 273 | |
joeverbout | 0:ea44dc9ed014 | 274 | template<int _depth> class TypeDepth |
joeverbout | 0:ea44dc9ed014 | 275 | { |
joeverbout | 0:ea44dc9ed014 | 276 | enum { depth = CV_USRTYPE1 }; |
joeverbout | 0:ea44dc9ed014 | 277 | typedef void value_type; |
joeverbout | 0:ea44dc9ed014 | 278 | }; |
joeverbout | 0:ea44dc9ed014 | 279 | |
joeverbout | 0:ea44dc9ed014 | 280 | template<> class TypeDepth<CV_8U> |
joeverbout | 0:ea44dc9ed014 | 281 | { |
joeverbout | 0:ea44dc9ed014 | 282 | enum { depth = CV_8U }; |
joeverbout | 0:ea44dc9ed014 | 283 | typedef uchar value_type; |
joeverbout | 0:ea44dc9ed014 | 284 | }; |
joeverbout | 0:ea44dc9ed014 | 285 | |
joeverbout | 0:ea44dc9ed014 | 286 | template<> class TypeDepth<CV_8S> |
joeverbout | 0:ea44dc9ed014 | 287 | { |
joeverbout | 0:ea44dc9ed014 | 288 | enum { depth = CV_8S }; |
joeverbout | 0:ea44dc9ed014 | 289 | typedef schar value_type; |
joeverbout | 0:ea44dc9ed014 | 290 | }; |
joeverbout | 0:ea44dc9ed014 | 291 | |
joeverbout | 0:ea44dc9ed014 | 292 | template<> class TypeDepth<CV_16U> |
joeverbout | 0:ea44dc9ed014 | 293 | { |
joeverbout | 0:ea44dc9ed014 | 294 | enum { depth = CV_16U }; |
joeverbout | 0:ea44dc9ed014 | 295 | typedef ushort value_type; |
joeverbout | 0:ea44dc9ed014 | 296 | }; |
joeverbout | 0:ea44dc9ed014 | 297 | |
joeverbout | 0:ea44dc9ed014 | 298 | template<> class TypeDepth<CV_16S> |
joeverbout | 0:ea44dc9ed014 | 299 | { |
joeverbout | 0:ea44dc9ed014 | 300 | enum { depth = CV_16S }; |
joeverbout | 0:ea44dc9ed014 | 301 | typedef short value_type; |
joeverbout | 0:ea44dc9ed014 | 302 | }; |
joeverbout | 0:ea44dc9ed014 | 303 | |
joeverbout | 0:ea44dc9ed014 | 304 | template<> class TypeDepth<CV_32S> |
joeverbout | 0:ea44dc9ed014 | 305 | { |
joeverbout | 0:ea44dc9ed014 | 306 | enum { depth = CV_32S }; |
joeverbout | 0:ea44dc9ed014 | 307 | typedef int value_type; |
joeverbout | 0:ea44dc9ed014 | 308 | }; |
joeverbout | 0:ea44dc9ed014 | 309 | |
joeverbout | 0:ea44dc9ed014 | 310 | template<> class TypeDepth<CV_32F> |
joeverbout | 0:ea44dc9ed014 | 311 | { |
joeverbout | 0:ea44dc9ed014 | 312 | enum { depth = CV_32F }; |
joeverbout | 0:ea44dc9ed014 | 313 | typedef float value_type; |
joeverbout | 0:ea44dc9ed014 | 314 | }; |
joeverbout | 0:ea44dc9ed014 | 315 | |
joeverbout | 0:ea44dc9ed014 | 316 | template<> class TypeDepth<CV_64F> |
joeverbout | 0:ea44dc9ed014 | 317 | { |
joeverbout | 0:ea44dc9ed014 | 318 | enum { depth = CV_64F }; |
joeverbout | 0:ea44dc9ed014 | 319 | typedef double value_type; |
joeverbout | 0:ea44dc9ed014 | 320 | }; |
joeverbout | 0:ea44dc9ed014 | 321 | |
joeverbout | 0:ea44dc9ed014 | 322 | //! @} |
joeverbout | 0:ea44dc9ed014 | 323 | |
joeverbout | 0:ea44dc9ed014 | 324 | } // cv |
joeverbout | 0:ea44dc9ed014 | 325 | |
joeverbout | 0:ea44dc9ed014 | 326 | #endif // __OPENCV_CORE_TRAITS_HPP__ |
joeverbout | 0:ea44dc9ed014 | 327 |