00001 #ifndef _JARGONTBROUTINES_H_
00002 #define _JARGONTBROUTINES_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <cstdlib>
00018 #include <cstring>
00019 #include <iostream>
00020
00021 extern "C"
00022 {
00023 #include <math.h>
00024 }
00025
00026 #include <vector>
00027 #include "DLImage.h"
00028 #include "DLComponent.h"
00029
00031
00032 typedef struct {
00033 int hnode_wt, vnode_wt;
00034 int hto_edge, vto_edge;
00035 int hfrom_edge, vfrom_edge;
00036 } TB_nodes;
00037
00039 typedef struct {
00040 float hor_mean;
00041 float ver_mean;
00042 float asr;
00043 float hor_num;
00044 float ver_num;
00045 float hor_dx;
00046 float ver_dy;
00047 } TB_stats;
00048
00049 #define INSUFFICIENT_MEMORY -4
00050 #define INTMAXDISTBETWEENCOMP 100
00051 #define SLOPE_CHAR 0.5
00052 #define MIN_LINKS 15
00053 #define MINCOMP 20 // for tb_CalcLineOrientation
00054
00055
00056
00057
00060
00061
00062 class JargonTBRoutines
00063 {
00064
00065
00066
00067 public:
00068 static int iLUT[8];
00069
00120
00121 static int tb_CalcLineOrientation(DLImage &dimage, vector<DLComponent> * activecc, int iNumber, int iPctDiff) ;
00122 static void put_on_list_dl(TB_nodes *N, int i, int j, float dx, float dy);
00126
00127 static int tb_CalcQuadrantMasses(unsigned char* uscImage, int iRows, int iCols, int** iQuadMasses);
00131
00132
00133 static int tb_PackUCArray(unsigned char* image, unsigned char** newimage,int iRow, int iCol) ;
00134
00136
00137 static int tb_GetResizedComponent(DLComponent * ccomp, unsigned char** image, int iResizeRow, int iResizeCol);
00138
00143 static int tb_RotateComponent(unsigned char* origimage, unsigned char** rimage, int iRows, int iCols, int iDegrees);
00144
00146
00147
00148 static int tbCompressUCArray(unsigned char* image, unsigned char** newimage,
00149 int iRow, int iCol) ;
00150
00151
00152 };
00153 #endif //_JARGONTBROUTINES_H_