reference/ocr-new/link.cc
changeset 0 6b8091ca909a
equal deleted inserted replaced
-1:000000000000 0:6b8091ca909a
       
     1 #include <tcl.h>
       
     2 #include "link.h"
       
     3 #include "tcl_interface.h"
       
     4 #include "system.h"
       
     5 
       
     6 /*
       
     7 
       
     8 To link tcl and C variables:  (variable num)
       
     9 
       
    10 int num;
       
    11 LINK_VARIABLE(num, INT);
       
    12 
       
    13 make sure the variable is external and in system.h
       
    14 so that everyone can get at it
       
    15 
       
    16 */
       
    17 
       
    18 
       
    19 int DISPLAY_SPELLING_MISTAKES = 0;
       
    20 extern Tcl_Interp* TCL_ip;
       
    21 
       
    22 #define LINK_VARIABLE(name, type) \
       
    23 Tcl_LinkVar(TCL_ip, #name, (void*) &name, TCL_LINK_##type)
       
    24 
       
    25 int init_link_vars()
       
    26 {
       
    27   LINK_VARIABLE(ENABLE_USER_INTERFACE, INT);  // 0 turns the display off 
       
    28   LINK_VARIABLE(VERY_LOW_CONFIDENCE, INT); // Words that display in red
       
    29   LINK_VARIABLE(LOW_CONFIDENCE, INT); // Words that will be displayed in blue
       
    30   LINK_VARIABLE(DISPLAY_LINE_BOUNDARIES, INT); // Words that display in blue
       
    31   LINK_VARIABLE(DISPLAY_BOUNDING_BOXES, INT); // Display component boundaries
       
    32   LINK_VARIABLE(SPELLCHECK, INT); // should the page be spellchecked
       
    33   
       
    34 
       
    35   LINK_VARIABLE(DISPLAY_IMAGE, INT); // display the scanned image?
       
    36   LINK_VARIABLE(DESKEW_METHOD, INT); // 1 for rle, 0 for bitmap
       
    37   LINK_VARIABLE(DISPLAY_SPELLING_MISTAKES, INT); 
       
    38   LINK_VARIABLE(SCALE_FACTOR, DOUBLE);
       
    39   LINK_VARIABLE(NoiseTolerance, INT);// Minimum num of pixels in line of text 
       
    40   
       
    41   LINK_VARIABLE(MinLineSize, INT);        // Minimum number of rows in line of text
       
    42   LINK_VARIABLE(MinVertSeparation, INT);  // Minimum number of rows between lines of text
       
    43   LINK_VARIABLE(MinHorizSeparation, INT); // Minimum number of blank pixels btween chars
       
    44   LINK_VARIABLE(ConfidenceThreshold, INT);// Minimum confidence for some operations
       
    45   LINK_VARIABLE(JoinTolerance, INT);     // Maximum number of pixels 
       
    46                                          // joining two fused characters
       
    47   
       
    48   // The next 4 are used in character grouping
       
    49   LINK_VARIABLE( MaxVertSize, INT);  // Max vert pixels in char 
       
    50   LINK_VARIABLE( BaseLineTolerance, INT);  // How far from baseline is 
       
    51                                            // okay 1/INT * linesize
       
    52   LINK_VARIABLE( TopLineTolerance, INT);   // How far from topline 
       
    53                                            //is okay 1/INT *linesize
       
    54   
       
    55 
       
    56   /* Constants for the number of horizontal and vertical divisions 
       
    57      for determining the gray scale property vector for each component */
       
    58   
       
    59   LINK_VARIABLE( NumHorizDiv, INT);        //Number of horizontal divisions
       
    60   LINK_VARIABLE( NumVertDiv, INT);         //Number of vertical divisions
       
    61   LINK_VARIABLE( SCALE_FACTOR, DOUBLE);
       
    62   LINK_VARIABLE( ZONING_SCALE_FACTOR, DOUBLE);
       
    63 }
       
    64 
       
    65 
       
    66 
       
    67 
       
    68