00001 #ifndef _JSCRIPT_H_
00002 #define _JSCRIPT_H_
00003
00004 #include <algorithm>
00005 using namespace std;
00006
00007 #include "DLConnectedComponents.h"
00008 #include "DLImage.h"
00009 #include "DLComponent.h"
00010
00011 #include "JMorphology.h"
00012 #include "JStatistics.h"
00013 #include "JHamming.h"
00014
00015 #define RESCALE_HEIGHT 30
00016 #define RESCALE_WIDTH 30
00017 #define MAX_FILENAME_LEN 500
00018 #define BITWISE_HALFWAY_POINT 25
00019
00020 const static char DL_JARGON_VERSION[] = "JARGON_BETA_1.0 - $Name: $";
00021
00100
00101 typedef struct _language_results {
00103 char language[50];
00105 int total_symbol_count;
00107 int correctly_matched;
00109 int incorrectly_matched;
00111 int matched_to_other;
00113 char *prev;
00115 char *next;
00117 char spare[50];
00118 } language_results;
00119
00125
00126
00127 class JScript {
00128
00129 public:
00141 void read_script_data(char *language_list_path, language_profile **language_array, int *language_count, int scaled_height, int scaled_width);
00155 static void ReadScriptData(char *language_list_path, language_profile **language_array, int *language_count, int scaled_height, int scaled_width, float *threshold,
00156 int **gray_values);
00157
00178 int jarGetScriptNo(char *script);
00179
00185 JScript(char *script_data_file_path);
00189 ~JScript();
00198 void changeBorders( int top, int left, int bottom, int right);
00199
00203 void clearDistribution();
00212 void disableScript(int script_no);
00217 void enableScript(int script_no);
00221 void enableAllScripts();
00227 void setDirections(int newdirections[4]);
00230 void setSymbol_count(int symbol_limit);
00234 void setOrientThreshold(int thresh);
00241 char *getScript(DLImage &testImageP);
00242
00247 int *getDirections() { return (&directions[0]); }
00251 float *getDistribution() { return (&symbol_distribution[0]); }
00257 char *getFirst() { return (&best_fit_script[0]); }
00260 char *getSecond() { return (&second_best_script[0]); }
00263 int getOrientation() { return (_orientation); }
00264 char *getOrient_char() { return (&orient_char[0]); }
00265 int *getProb() { return (probability); }
00268 int getScriptCount() { return (language_count); }
00269
00273 int getSymbol_count() { return (symbol_count); }
00274
00278 int getSymbolsUsed() { return (symbols_used_for_id_count); }
00282 int getOrientThreshold() { return (orient_threshold); }
00283
00284 static string dlGetVersionInfo();
00285
00286 private:
00287
00288
00289
00290
00291 float *symbol_distribution;
00292
00293
00294 float *randoms;
00295
00296
00297 int *hamming_lookup;
00298
00299 int *probability;
00300
00305 language_profile *first_lang;
00306 int language_count;
00307 int min_comp_size;
00308 int max_height;
00309 int max_width;
00310 int min_height;
00311 int min_width;
00312 int symbol_count;
00313 int symbols_used_for_id_count;
00314 int min_symbol_count;
00315 float blob_percent;
00316 int rescale_height;
00317 int rescale_width;
00318 int upper_offset;
00319 int lower_offset;
00320 int left_offset;
00321 int right_offset;
00322 float reliability_threshold;
00323 float template_threshold;
00324 float separation_threshold;
00325 float mlp_thresh;
00326 int orient_threshold;
00327 int hamming;
00328 int directions[4];
00329
00330
00331
00332
00333
00334 int _orientation;
00335 char orient_char[2];
00336 char script_id[100];
00337 char best_fit_script[100];
00338 char second_best_script[100];
00339
00340 char script_selection_algorithm[100];
00341 };
00342
00343
00344 #endif //_JSCRIPT_H_