00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __TLVISION_H__
00018 #define __TLVISION_H__
00019
00020
00021
00022 #include <iostream>
00023 #include <stdio.h>
00024 #include <malloc.h>
00025 #define _USE_MATH_DEFINES
00026 #include <math.h>
00027
00028 using std::cout;
00029 using std::endl;
00030
00031
00032 #ifndef M_PI
00033 #define TL_PI 3.14159265358979323846
00034 #else
00035 #define TL_PI M_PI
00036 #endif
00037
00038
00039
00040 #define TL_DEFAULT_COLS 320
00041 #define TL_DEFAULT_ROWS 240
00042 #define TL_MAX_PIXEL_VAL 255
00043 #define TL_MIN_PIXEL_VAL 0
00044 #define TL_MAX_HPIXEL_VAL 65535
00045
00046
00047
00048 #define TL_NOT_CONNEX 0
00049 #define TL_CONNEX_4 1
00050 #define TL_CONNEX_8 2
00051
00052
00053
00054
00055
00056
00057
00058 typedef unsigned char tlPixel;
00059 typedef short tlHRPixel;
00060
00061 typedef int tlHistData;
00062 #define TL_PIXEL(row,col,width) (((row)*(width))+(col))
00063 #define TL_MIN(a,b) (((a)<(b))?(a):(b))
00064 #define TL_MAX(a,b) (((a)>(b))?(a):(b))
00065 #define TL_BOUND(a,x,b) (TL_MIN(TL_MAX((a),(x)),(b)))
00066
00067
00068
00069
00070
00071
00072 #define TL_HMHL_TO_HVAL(hm, hl) (((hm) << 8) | (hl))
00073
00074
00075 #define TL_HVAL_TO_HM(hval) ((hval) >> 8)
00076 #define TL_HVAL_TO_HL(hval) ((hval & 0xff))
00077
00078
00079 #define TL_DEG_TO_HVAL(deg) (unsigned short int) (TL_MAX_HPIXEL_VAL*(deg)/360)
00080 #define TL_HVAL_TO_DEG(hval) (360.0f*(hval)/TL_MAX_HPIXEL_VAL) // float
00081
00082
00083 #define TL_PCT_TO_SVAL(pct) (tlPixel) (TL_MAX_PIXEL_VAL*(pct)/100)
00084 #define TL_SVAL_TO_PCT(sval) (100.0f*(sval)/TL_MAX_PIXEL_VAL) // float
00085
00086
00087 #define TL_PCT_TO_IVAL(pct) (tlPixel) (TL_MAX_PIXEL_VAL*(pct)/100)
00088 #define TL_IVAL_TO_PCT(ival) (100.0f*(ival)/TL_MAX_PIXEL_VAL) // float
00089
00090
00091 #define TL_PAUSE getc();
00092
00093 #define TL_NOT_IMPLEMENTED { \
00094 printf ("TL lib error: call to an unimplemented routine\n"); \
00095 return TL_ERROR_NOT_IMPLEMENTED; \
00096 }
00097
00098
00099 class tlSize;
00100 class tlLocation;
00101 class tlRect;
00102 class tlPixelArray;
00103 class tlBackground;
00104 class tlBlobs;
00105 class tlHough;
00106 class tlChain;
00107 class tlColor;
00108 class tlColorModel;
00109 template <typename T> class tlConst;
00110 class tlHist;
00111 class tlHist2D;
00112 class tlImage;
00113 class tlLine;
00114 class tlMask;
00115 class tlObject;
00116 class tlPoint;
00117 class tlSpiral;
00118
00119
00120
00121 extern int tlVerbose;
00122 void tl_set_verbose (int val);
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 enum tl_format { RGB, NRG, HSI, YUV, GRAY, BIN, STEREO, CUSTOM };
00133
00134
00135 #define TL_RGB_WIDTH 3
00136 #define TL_NRG_WIDTH 2
00137 #define TL_HSI_WIDTH 4
00138 #define TL_YUV_WIDTH 3
00139 #define TL_GRAY_WIDTH 1
00140 #define TL_BIN_WIDTH 1
00141 #define TL_STEREO_WIDTH 1
00142
00143
00144 #define TL_MAX_PIXEL_WIDTH 4
00145
00146
00147 inline int tl_pixel_width (tl_format format)
00148 {
00149 switch(format){
00150 case RGB: return TL_RGB_WIDTH;
00151 case YUV: return TL_YUV_WIDTH;
00152 case NRG: return TL_NRG_WIDTH;
00153 case HSI: return TL_HSI_WIDTH;
00154 case GRAY: return TL_GRAY_WIDTH;
00155 case BIN: return TL_BIN_WIDTH;
00156 case STEREO: return TL_STEREO_WIDTH;
00157 default:
00158 return 0;
00159 }
00160 }
00161
00162
00163
00164 #define TL_CHANNEL_RED 0
00165 #define TL_CHANNEL_GREEN 1
00166 #define TL_CHANNEL_BLUE 2
00167 #define TL_CHANNEL_H 0
00168 #define TL_CHANNEL_HM 0
00169 #define TL_CHANNEL_HL 1
00170 #define TL_CHANNEL_S 2
00171 #define TL_CHANNEL_I 3
00172 #define TL_CHANNEL_NR 0
00173 #define TL_CHANNEL_NG 1
00174 #define TL_CHANNEL_GRAY 0
00175 #define TL_CHANNEL_BIN 0
00176 #define TL_CHANNEL_STEREO 0
00177
00178
00179
00180
00181
00182
00183
00184
00185 #if _MSC_VER >= 1400
00186 #define POINTER_64 __ptr64
00187 #endif
00188
00189
00190
00191 #include "tlChannel.h"
00192 #include "tlConvolution.h"
00193 #include "tlEdges.h"
00194 #include "tlError.h"
00195 #include "tlExtract.h"
00196 #include "tlFile.h"
00197 #include "tlFilter.h"
00198 #include "tlFind.h"
00199 #include "tlFormatConversion.h"
00200 #include "tlMemory.h"
00201 #include "tlMorph.h"
00202 #include "tlNormalize.h"
00203 #include "tlPixel.h"
00204 #include "tlScale.h"
00205 #include "tlThread.h"
00206 #include "tlTimer.h"
00207 #include "tlTransforms.h"
00208
00209
00210 #ifndef _TLIB_BUILD_
00211
00212
00213 #include "tlSize.h"
00214 #include "tlLocation.h"
00215 #include "tlRect.h"
00216 #include "tlPixelArray.h"
00217 #include "tlBackground.h"
00218 #include "tlBlobs.h"
00219 #include "tlChain.h"
00220 #include "tlColor.h"
00221 #include "tlColorModel.h"
00222 #include "tlConst.h"
00223 #include "tlHist.h"
00224 #include "tlHist2D.h"
00225 #include "tlHough.h"
00226 #include "tlImage.h"
00227 #include "tlLine.h"
00228 #include "tlMask.h"
00229 #include "tlObject.h"
00230 #include "tlPoint.h"
00231 #include "tlSpiral.h"
00232
00233
00234 #if (_MSC_VER >= 1400) && defined(_DEBUG)
00235 extern "C" {
00236 _CRTIMP void __cdecl _invalid_parameter_noinfo(void) { }
00237 }
00238 #endif
00239
00240 #endif
00241
00242
00243
00244
00245
00246
00247
00248
00249 extern char *tl_app_name;
00250 int tl_init_lib ();
00251 int tl_init_lib (int argc, char **argv);
00252
00253
00254
00255 #endif
00256