reference/ocr-new/link.cc
author viric@llimona
Thu, 18 May 2006 23:12:51 +0200
changeset 0 6b8091ca909a
permissions -rw-r--r--
Init from working directory of svn repository.

#include <tcl.h>
#include "link.h"
#include "tcl_interface.h"
#include "system.h"

/*

To link tcl and C variables:  (variable num)

int num;
LINK_VARIABLE(num, INT);

make sure the variable is external and in system.h
so that everyone can get at it

*/


int DISPLAY_SPELLING_MISTAKES = 0;
extern Tcl_Interp* TCL_ip;

#define LINK_VARIABLE(name, type) \
Tcl_LinkVar(TCL_ip, #name, (void*) &name, TCL_LINK_##type)

int init_link_vars()
{
  LINK_VARIABLE(ENABLE_USER_INTERFACE, INT);  // 0 turns the display off 
  LINK_VARIABLE(VERY_LOW_CONFIDENCE, INT); // Words that display in red
  LINK_VARIABLE(LOW_CONFIDENCE, INT); // Words that will be displayed in blue
  LINK_VARIABLE(DISPLAY_LINE_BOUNDARIES, INT); // Words that display in blue
  LINK_VARIABLE(DISPLAY_BOUNDING_BOXES, INT); // Display component boundaries
  LINK_VARIABLE(SPELLCHECK, INT); // should the page be spellchecked
  

  LINK_VARIABLE(DISPLAY_IMAGE, INT); // display the scanned image?
  LINK_VARIABLE(DESKEW_METHOD, INT); // 1 for rle, 0 for bitmap
  LINK_VARIABLE(DISPLAY_SPELLING_MISTAKES, INT); 
  LINK_VARIABLE(SCALE_FACTOR, DOUBLE);
  LINK_VARIABLE(NoiseTolerance, INT);// Minimum num of pixels in line of text 
  
  LINK_VARIABLE(MinLineSize, INT);        // Minimum number of rows in line of text
  LINK_VARIABLE(MinVertSeparation, INT);  // Minimum number of rows between lines of text
  LINK_VARIABLE(MinHorizSeparation, INT); // Minimum number of blank pixels btween chars
  LINK_VARIABLE(ConfidenceThreshold, INT);// Minimum confidence for some operations
  LINK_VARIABLE(JoinTolerance, INT);     // Maximum number of pixels 
                                         // joining two fused characters
  
  // The next 4 are used in character grouping
  LINK_VARIABLE( MaxVertSize, INT);  // Max vert pixels in char 
  LINK_VARIABLE( BaseLineTolerance, INT);  // How far from baseline is 
                                           // okay 1/INT * linesize
  LINK_VARIABLE( TopLineTolerance, INT);   // How far from topline 
                                           //is okay 1/INT *linesize
  

  /* Constants for the number of horizontal and vertical divisions 
     for determining the gray scale property vector for each component */
  
  LINK_VARIABLE( NumHorizDiv, INT);        //Number of horizontal divisions
  LINK_VARIABLE( NumVertDiv, INT);         //Number of vertical divisions
  LINK_VARIABLE( SCALE_FACTOR, DOUBLE);
  LINK_VARIABLE( ZONING_SCALE_FACTOR, DOUBLE);
}