JargonTBRoutines.h

Go to the documentation of this file.
00001 #ifndef _JARGONTBROUTINES_H_
00002 #define _JARGONTBROUTINES_H_
00003 
00004 /* //////////////////////////////////////////////////////////////////////////
00005 // JargonTBRoutines.cpp  07/02/04  Removed Printfs
00006 //
00007 // These modules were ported to Jargon from tb:
00008 //    tbCalcLineOrientation.c ,(removed Edges)
00009 //    tbCalcQuadrantMasses.c,  
00010 //    tbPackUCArray.c         
00011 //    tbGetResizedComponent.c
00012 //    tbRotateComponent.c
00013 //
00014 //  Component Filtering for Jargon is done by using dlFilterCCxxx methods
00015 //  Memory allocation in JargonTBRoutines is via new
00016 */
00017 #include <cstdlib>    
00018 #include <cstring>
00019 #include <iostream>
00020 
00021 extern "C" 
00022 {
00023 #include <math.h>
00024 }//  fabs
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 /* integer max distance between adj. comp. */
00051 #define  SLOPE_CHAR 0.5
00052 #define  MIN_LINKS 15
00053 #define  MINCOMP 20    // for tb_CalcLineOrientation
00054 
00055 // common data
00056 //int iLUT[8]= {128,64,32,16,8,4,2,1};
00057 
00060 
00061 
00062 class JargonTBRoutines 
00063 {
00064    //friend class JMorphology;
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_

Generated on Fri Feb 23 15:32:33 2007 for Jargon by  doxygen 1.5.1