JMorphology.h

Go to the documentation of this file.
00001 #ifndef _JMORPOHOLOGY_H_
00002 #define _JMORPOHOLOGY_H_
00003 
00004 #include <string.h>
00005 
00006 
00007 #define FLIP_IMAGE_THRESHOLD .03
00008 
00009 
00010 typedef struct _cluster *jcluster_ptr;
00011 
00015 
00016 typedef struct _cluster {
00018    char *first_image;
00020    int *centroid;
00021    /* number of components used to form the cluster*/
00022    int count;
00023    /* number of components that match this component and were of
00024     * this components script (used in computing reliabililty) 
00025     */
00026    int correct_matches;    
00027    /* number of components that match this component and were not of
00028     * this components script (used in computing reliabililty) 
00029     */
00030    int incorrect_matches; 
00031    /* Number, between 0 and 1, representing how unique the symbol is 
00032     * to the script 
00033     */
00034    float reliability;
00035    jcluster_ptr prev;
00036    jcluster_ptr next;
00037    unsigned long similar_symbol_count;
00038    int matches_per_image;
00039    int on_pixels;
00043    int densities[4];
00044    int cluster_number;
00045    char spare[18];
00046 } jcluster;
00047 
00049 
00050 typedef struct i_language_profile {
00053    char identification[21];
00056    int cluster_count;
00057    /* number of clusters remaining after they are
00058     * filtered 
00059     */
00060 
00061    int filtered_cluster_count;
00062    /* number of training images used to form clusters for 
00063     * the script 
00064     */
00065    int file_count;
00068    int hamming;
00071    int symbol_count;
00075    int small_cluster_threshold;
00078    int min_size;
00079    /* Maximum height of a connected component to be used in training
00080     */
00081    int max_height;
00082    /* Maximum width of a connected component to be used in training
00083     */
00084    int max_width;
00085    int total_symbol_count;
00086    /* Number of symbols correctly match to this script during the
00087     * reliability calculation 
00088     */
00089    int correctly_matched;
00090    /* Number of symbols incorrectly match to this script during the
00091     * reliability calculation 
00092     */
00093    int incorrectly_matched;
00094    unsigned int hamming_sum;
00097    unsigned int best_hamming;
00098    float matched_sum;
00099    unsigned int *cluster32;
00100    char spare[18];
00101    char *cluster_data;
00102    jcluster *first_cluster;
00103    char *prev;
00104    char *next;
00105 } language_profile;
00106 
00107 #include "DLImage.h"
00108 #include "DLConnectedComponents.h"
00109 #include "JargonTBRoutines.h"
00110 
00112 
00115 class JMorphology {
00116 //      friend class JScript;
00117    public:
00118 //private:
00121    static void compress_to_bit(unsigned char *byte_array, unsigned char *destination,
00122                                int bits_needed, int bytes_needed);
00123 
00124    static int ConvertData32Bit(language_profile* first_lang,
00125                                int iPixelRow, int iPixelCol,
00126                                unsigned int** uippNewData);
00127 
00128 
00129         
00130    static int  get_mean_and_stddev( int     local_directions[4], 
00131                                     float * scores[4],
00132                                     int *   prob,
00133                                     int     language_count,
00134                                     int     u_symbol_count,
00135                                     float   m_array[4],
00136                                     float   s_array[4],
00137                                     float * high_stddev,
00138                                     float * second_stddev,
00139                                     int *   second);
00140 
00143    static int identify_and_orient(
00144       int hamming_number,
00145       int min_component_size, int max_height, int
00146       max_width, int min_height, int min_width,
00147       int min_symbol_count,
00148       float *blob_percent, 
00149       int symbolcount,
00150       int rescale_height, int rescale_width,
00151       int upper_offset,
00152       int lower_offset, int left_offset, int right_offset,
00153       float *reliability_threshold, 
00154       DLImage & strDocImage,   //       TBdocument * strDocument,
00155       int language_count, language_profile * first_lang,
00156       char *script, int *used_symbol_count,
00157       int *file_symbol_count,
00158       int *filtered_symbol_count,
00159       float *randoms, int max_random_index,
00160       float *separation_threshold, char *best_fit_script,
00161       char *second_best_script,
00162       float *stddev, float *separation, int collect_data_flag,
00163       float *symbol_distribution,
00164       unsigned int *hamming_lookup, int *prob,
00165       float *mlp_thresh,
00166       char *orientation, int *directions,
00167       int orient_det_threshold);
00168 
00169    static void ConvertUSCInt(unsigned int* ui, unsigned char* image);
00170 
00171    static void freeLanguageProfileStruct(language_profile * langProfile, int langCount);
00172 
00173 
00174 }; //end class
00175 #endif //_JMORPOHOLOGY_H_

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