mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-13 16:09:04 +08:00
023e1b340e
* api: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccmain: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccstruct: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * classify: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * cutil: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * dict: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * textord: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * training: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * wordrec: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccutil: Replace Tesseract data types by POSIX data types Now all Tesseract data types which are no longer needed can be removed from ccutil/host.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Remove the macros which are now unused from ccutil/host.h. Remove also the obsolete history comments. Signed-off-by: Stefan Weil <sw@weilnetz.de> * Fix build error caused by ambiguous ClipToRange Error message vom Appveyor CI: C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj] C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj] c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange' C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char' C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int' Signed-off-by: Stefan Weil <sw@weilnetz.de> * unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de>
96 lines
3.8 KiB
C++
96 lines
3.8 KiB
C++
/**********************************************************************
|
|
* File: edgblob.h (Formerly edgeloop.h)
|
|
* Description: Functions to clean up an outline before approximation.
|
|
* Author: Ray Smith
|
|
* Created: Tue Mar 26 16:56:25 GMT 1991
|
|
*
|
|
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
|
** you may not use this file except in compliance with the License.
|
|
** You may obtain a copy of the License at
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
** See the License for the specific language governing permissions and
|
|
** limitations under the License.
|
|
*
|
|
**********************************************************************/
|
|
|
|
#ifndef EDGBLOB_H
|
|
#define EDGBLOB_H
|
|
|
|
#include "scrollview.h"
|
|
#include "params.h"
|
|
#include "ocrblock.h"
|
|
#include "coutln.h"
|
|
#include "crakedge.h"
|
|
|
|
#define BUCKETSIZE 16
|
|
|
|
class OL_BUCKETS
|
|
{
|
|
public:
|
|
OL_BUCKETS( //constructor
|
|
ICOORD bleft, //corners
|
|
ICOORD tright);
|
|
|
|
~OL_BUCKETS () { //cleanup
|
|
delete[]buckets;
|
|
}
|
|
C_OUTLINE_LIST *operator () (//array access
|
|
int16_t x, //image coords
|
|
int16_t y);
|
|
//first non-empty bucket
|
|
C_OUTLINE_LIST *start_scan() {
|
|
for (index = 0; buckets[index].empty () && index < bxdim * bydim - 1;
|
|
index++);
|
|
return &buckets[index];
|
|
}
|
|
//next non-empty bucket
|
|
C_OUTLINE_LIST *scan_next() {
|
|
for (; buckets[index].empty () && index < bxdim * bydim - 1; index++);
|
|
return &buckets[index];
|
|
}
|
|
int32_t count_children( //recursive sum
|
|
C_OUTLINE *outline, //parent outline
|
|
int32_t max_count); // max output
|
|
int32_t outline_complexity( // new version of count_children
|
|
C_OUTLINE *outline, // parent outline
|
|
int32_t max_count, // max output
|
|
int16_t depth); // level of recursion
|
|
void extract_children( //single level get
|
|
C_OUTLINE *outline, //parent outline
|
|
C_OUTLINE_IT *it); //destination iterator
|
|
|
|
private:
|
|
C_OUTLINE_LIST * buckets; //array of buckets
|
|
int16_t bxdim; //size of array
|
|
int16_t bydim;
|
|
ICOORD bl; //corners
|
|
ICOORD tr;
|
|
int32_t index; //for extraction scan
|
|
};
|
|
|
|
void extract_edges(Pix* pix, // thresholded image
|
|
BLOCK* block); // block to scan
|
|
void outlines_to_blobs( //find blobs
|
|
BLOCK *block, //block to scan
|
|
ICOORD bleft, //block box //outlines in block
|
|
ICOORD tright,
|
|
C_OUTLINE_LIST *outlines);
|
|
void fill_buckets( //find blobs
|
|
C_OUTLINE_LIST *outlines, //outlines in block
|
|
OL_BUCKETS *buckets //output buckets
|
|
);
|
|
void empty_buckets( //find blobs
|
|
BLOCK *block, //block to scan
|
|
OL_BUCKETS *buckets //output buckets
|
|
);
|
|
BOOL8 capture_children( //find children
|
|
OL_BUCKETS *buckets, //bucket sort clanss
|
|
C_BLOB_IT *reject_it, //dead grandchildren
|
|
C_OUTLINE_IT *blob_it //output outlines
|
|
);
|
|
#endif
|