Skip to content

Commit

Permalink
Remove chopper.h
Browse files Browse the repository at this point in the history
It is no longer needed after some reordering of code in chopper.cpp.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 29, 2018
1 parent 286dfb0 commit 6f8bd34
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 131 deletions.
4 changes: 0 additions & 4 deletions src/ccmain/applybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: applybox.cpp (Formerly applybox.c)
* Description: Re segment rows according to box file data
* Author: Phil Cheatle
* Created: Wed Nov 24 09:11:23 GMT 1993
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,9 +21,6 @@
#include <cstring>
#include "allheaders.h"
#include "boxread.h"
#ifndef DISABLED_LEGACY_ENGINE
#include "chopper.h"
#endif
#include "pageres.h"
#include "unichar.h"
#include "unicharset.h"
Expand Down
1 change: 0 additions & 1 deletion src/wordrec/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if !DISABLED_LEGACY_ENGINE
noinst_HEADERS += \
associate.h \
chop.h \
chopper.h \
drawfx.h \
findseam.h \
language_model.h \
Expand Down
133 changes: 56 additions & 77 deletions src/wordrec/chopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
********************************************************************************
*
* File: chopper.cpp (Formerly chopper.c)
* Description:
* Author: Mark Seaman, OCR Technology
* Created: Fri Oct 16 14:37:00 1987
* Modified: Tue Jul 30 16:18:52 1991 (Mark Seaman) marks@hpgrlt
* Language: C
* Package: N/A
* Status: Reusable Software Component
*
* (c) Copyright 1987, Hewlett-Packard Company.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -27,7 +21,6 @@
I n c l u d e s
----------------------------------------------------------------------*/

#include "chopper.h"
#include "blamer.h" // for BlamerBundle, IRR_CORRECT
#include "blobs.h" // for TPOINT, TBLOB, EDGEPT, TESSLINE, divisible_blob
#include "callcpp.h" // for Red
Expand All @@ -48,8 +41,6 @@
#include "tprintf.h" // for tprintf
#include "wordrec.h" // for Wordrec, SegSearchPending (ptr only)

class CHAR_FRAGMENT;

template <typename T> class GenericVector;

// Include automatically generated configuration file if running autoconf.
Expand All @@ -64,12 +55,51 @@ static const int kMaxNumChunks = 64;
/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/

/**
* @name check_blob
*
* @return true if blob has a non whole outline.
*/
static int check_blob(TBLOB *blob) {
TESSLINE *outline;
EDGEPT *edgept;

for (outline = blob->outlines; outline != nullptr; outline = outline->next) {
edgept = outline->loop;
do {
if (edgept == nullptr)
break;
edgept = edgept->next;
}
while (edgept != outline->loop);
if (edgept == nullptr)
return 1;
}
return 0;
}

/**
* @name any_shared_split_points
*
* Return true if any of the splits share a point with this one.
*/
static int any_shared_split_points(const GenericVector<SEAM*>& seams, SEAM *seam) {
int length;
int index;

length = seams.size();
for (index = 0; index < length; index++)
if (seam->SharesPosition(*seams[index])) return TRUE;
return FALSE;
}

/**
* @name preserve_outline_tree
*
* Copy the list of outlines.
*/
void preserve_outline(EDGEPT *start) {
static void preserve_outline(EDGEPT *start) {
EDGEPT *srcpt;

if (start == nullptr)
Expand All @@ -83,23 +113,20 @@ void preserve_outline(EDGEPT *start) {
srcpt->flags[1] = 2;
}


/**************************************************************************/
void preserve_outline_tree(TESSLINE *srcline) {
static void preserve_outline_tree(TESSLINE *srcline) {
TESSLINE *outline;

for (outline = srcline; outline != nullptr; outline = outline->next) {
preserve_outline (outline->loop);
}
}


/**
* @name restore_outline_tree
*
* Copy the list of outlines.
*/
EDGEPT *restore_outline(EDGEPT *start) {
static EDGEPT *restore_outline(EDGEPT *start) {
EDGEPT *srcpt;
EDGEPT *real_start;

Expand All @@ -123,9 +150,7 @@ EDGEPT *restore_outline(EDGEPT *start) {
return real_start;
}


/******************************************************************************/
void restore_outline_tree(TESSLINE *srcline) {
static void restore_outline_tree(TESSLINE *srcline) {
TESSLINE *outline;

for (outline = srcline; outline != nullptr; outline = outline->next) {
Expand All @@ -134,6 +159,18 @@ void restore_outline_tree(TESSLINE *srcline) {
}
}

/**********************************************************************
* total_containment
*
* Check to see if one of these outlines is totally contained within
* the bounding box of the other.
**********************************************************************/
static int16_t total_containment(TBLOB *blob1, TBLOB *blob2) {
TBOX box1 = blob1->bounding_box();
TBOX box2 = blob2->bounding_box();
return box1.contains(box2) || box2.contains(box1);
}

// Helper runs all the checks on a seam to make sure it is valid.
// Returns the seam if OK, otherwise deletes the seam and returns nullptr.
static SEAM* CheckSeam(int debug_level, int32_t blob_number, TWERD* word,
Expand Down Expand Up @@ -164,14 +201,14 @@ static SEAM* CheckSeam(int debug_level, int32_t blob_number, TWERD* word,
return seam;
}

namespace tesseract {

/**
* @name attempt_blob_chop
*
* Try to split the this blob after this one. Check to make sure that
* it was successful.
*/
namespace tesseract {
SEAM *Wordrec::attempt_blob_chop(TWERD *word, TBLOB *blob, int32_t blob_number,
bool italic_blob,
const GenericVector<SEAM*>& seams) {
Expand Down Expand Up @@ -276,50 +313,6 @@ SEAM *Wordrec::chop_overlapping_blob(const GenericVector<TBOX>& boxes,
return nullptr;
}

} // namespace tesseract


/**
* @name any_shared_split_points
*
* Return true if any of the splits share a point with this one.
*/
int any_shared_split_points(const GenericVector<SEAM*>& seams, SEAM *seam) {
int length;
int index;

length = seams.size();
for (index = 0; index < length; index++)
if (seam->SharesPosition(*seams[index])) return TRUE;
return FALSE;
}


/**
* @name check_blob
*
* @return true if blob has a non whole outline.
*/
int check_blob(TBLOB *blob) {
TESSLINE *outline;
EDGEPT *edgept;

for (outline = blob->outlines; outline != nullptr; outline = outline->next) {
edgept = outline->loop;
do {
if (edgept == nullptr)
break;
edgept = edgept->next;
}
while (edgept != outline->loop);
if (edgept == nullptr)
return 1;
}
return 0;
}


namespace tesseract {
/**
* @name improve_one_blob
*
Expand Down Expand Up @@ -644,18 +637,4 @@ int Wordrec::select_blob_to_split_from_fixpt(DANGERR *fixpt) {
return -1;
}


} // namespace tesseract


/**********************************************************************
* total_containment
*
* Check to see if one of these outlines is totally contained within
* the bounding box of the other.
**********************************************************************/
int16_t total_containment(TBLOB *blob1, TBLOB *blob2) {
TBOX box1 = blob1->bounding_box();
TBOX box2 = blob2->bounding_box();
return box1.contains(box2) || box2.contains(box1);
}
47 changes: 0 additions & 47 deletions src/wordrec/chopper.h

This file was deleted.

2 changes: 0 additions & 2 deletions src/wordrec/tface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: tface.cpp (Formerly tface.c)
* Description: C side of the Tess/tessedit C/C++ interface.
* Author: Ray Smith
* Created: Mon Apr 27 11:57:06 BST 1992
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,7 +18,6 @@

#include "callcpp.h"
#include "chop.h"
#include "chopper.h"
#include "globals.h"
#include "pageres.h"
#include "wordrec.h"
Expand Down

0 comments on commit 6f8bd34

Please sign in to comment.