Tesseract  3.02
tesseract-ocr/wordrec/olutil.h
Go to the documentation of this file.
00001 /* -*-C-*-
00002  ********************************************************************************
00003  *
00004  * File:        olutil.h  (Formerly olutil.h)
00005  * Description:
00006  * Author:       Mark Seaman, SW Productivity
00007  * Created:      Fri Oct 16 14:37:00 1987
00008  * Modified:     Wed Jul 10 14:21:55 1991 (Mark Seaman) marks@hpgrlt
00009  * Language:     C
00010  * Package:      N/A
00011  * Status:       Reusable Software Component
00012  *
00013  * (c) Copyright 1987, Hewlett-Packard Company.
00014  ** Licensed under the Apache License, Version 2.0 (the "License");
00015  ** you may not use this file except in compliance with the License.
00016  ** You may obtain a copy of the License at
00017  ** http://www.apache.org/licenses/LICENSE-2.0
00018  ** Unless required by applicable law or agreed to in writing, software
00019  ** distributed under the License is distributed on an "AS IS" BASIS,
00020  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00021  ** See the License for the specific language governing permissions and
00022  ** limitations under the License.
00023  *
00024  *********************************************************************************/
00025 #ifndef OLUTIL_H
00026 #define OLUTIL_H
00027 
00028 /*----------------------------------------------------------------------
00029               I n c l u d e s
00030 ----------------------------------------------------------------------*/
00031 #include "blobs.h"
00032 
00033 /*----------------------------------------------------------------------
00034               M a c r o s
00035 ----------------------------------------------------------------------*/
00036 /**********************************************************************
00037  * is_inside_angle
00038  *
00039  * Return true if the edgept supplied as input is an inside angle.  This
00040  * is determined by the angular change of the vectors from point to
00041  * point.
00042 
00043  **********************************************************************/
00044 
00045 #define is_inside_angle(pt)                                  \
00046 (angle_change ((pt)->prev, (pt), (pt)->next) < chop_inside_angle)
00047 
00048 /**********************************************************************
00049  * same_outline_bounds
00050  *
00051  * Return TRUE if these two outlines have the same bounds.
00052  **********************************************************************/
00053 
00054 #define same_outline_bounds(outline,other_outline)     \
00055 (outline->topleft.x  == other_outline->topleft.x  && \
00056         outline->topleft.y  == other_outline->topleft.y  && \
00057         outline->botright.x == other_outline->botright.x && \
00058         outline->botright.y == other_outline->botright.y)   \
00059 
00060 
00061 /**********************************************************************
00062  * weighted_edgept_dist
00063  *
00064  * Return the distance (squared) between the two edge points.
00065  **********************************************************************/
00066 
00067 #define weighted_edgept_dist(p1,p2,chop_x_y_weight)  \
00068 (((p1)->pos.x - (p2)->pos.x) *                \
00069         ((p1)->pos.x - (p2)->pos.x) * chop_x_y_weight +  \
00070         ((p1)->pos.y - (p2)->pos.y) *               \
00071         ((p1)->pos.y - (p2)->pos.y))
00072 
00073 /*----------------------------------------------------------------------
00074               F u n c t i o n s
00075 ----------------------------------------------------------------------*/
00076 void correct_blob_order(TBLOB *blob1, TBLOB *blob2); 
00077 
00078 void eliminate_duplicate_outlines(TBLOB *blob); 
00079 
00080 void setup_blob_outlines(TBLOB *blob); 
00081 
00082 #endif