34 |
35 | /* General and configuration defs */
36 | #include "endianness.h"
37 | #include "environ.h"
38 |
39 | /* Generic and non-image-specific containers */
40 | #include "array.h"
41 | #include "bbuffer.h"
42 | #include "heap.h"
43 | #include "list.h"
44 | #include "ptra.h"
45 | #include "queue.h"
46 | #include "rbtree.h"
47 | #include "stack.h"
48 |
49 | /* Imaging */
50 | #include "arrayaccess.h"
51 | #include "bmf.h"
52 | #include "ccbord.h"
53 | #include "dewarp.h"
54 | #include "gplot.h"
55 | #include "imageio.h"
56 | #include "jbclass.h"
57 | #include "morph.h"
58 | #include "pix.h"
59 | #include "recog.h"
60 | #include "regutils.h"
61 | #include "stringcode.h"
62 | #include "sudoku.h"
63 | #include "watershed.h"
64 |
65 |
66 | #endif /* LEPTONICA_ALLTYPES_H */
67 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/leptonica/bbuffer.h:
--------------------------------------------------------------------------------
1 | /*====================================================================*
2 | - Copyright (C) 2001 Leptonica. All rights reserved.
3 | -
4 | - Redistribution and use in source and binary forms, with or without
5 | - modification, are permitted provided that the following conditions
6 | - are met:
7 | - 1. Redistributions of source code must retain the above copyright
8 | - notice, this list of conditions and the following disclaimer.
9 | - 2. Redistributions in binary form must reproduce the above
10 | - copyright notice, this list of conditions and the following
11 | - disclaimer in the documentation and/or other materials
12 | - provided with the distribution.
13 | -
14 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 | - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 | - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | *====================================================================*/
26 |
27 | #ifndef LEPTONICA_BBUFFER_H
28 | #define LEPTONICA_BBUFFER_H
29 |
30 | /*!
31 | * \file bbuffer.h
32 | *
33 | *
34 | * Expandable byte buffer for reading data in from memory and
35 | * writing data out to other memory.
36 | *
37 | * This implements a queue of bytes, so data read in is put
38 | * on the "back" of the queue (i.e., the end of the byte array)
39 | * and data written out is taken from the "front" of the queue
40 | * (i.e., from an index marker "nwritten" that is initially set at
41 | * the beginning of the array.) As usual with expandable
42 | * arrays, we keep the size of the allocated array and the
43 | * number of bytes that have been read into the array.
44 | *
45 | * For implementation details, see bbuffer.c.
46 | *
47 | */
48 |
49 | /*! Expandable byte buffer for memory read/write operations */
50 | struct L_ByteBuffer
51 | {
52 | l_int32 nalloc; /*!< size of allocated byte array */
53 | l_int32 n; /*!< number of bytes read into to the array */
54 | l_int32 nwritten; /*!< number of bytes written from the array */
55 | l_uint8 *array; /*!< byte array */
56 | };
57 | typedef struct L_ByteBuffer L_BBUFFER;
58 |
59 |
60 | #endif /* LEPTONICA_BBUFFER_H */
61 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/leptonica/endianness.h:
--------------------------------------------------------------------------------
1 | #if !defined (L_BIG_ENDIAN) && !defined (L_LITTLE_ENDIAN)
2 | # if 0
3 | # ifdef __BIG_ENDIAN__
4 | # define L_BIG_ENDIAN
5 | # else
6 | # define L_LITTLE_ENDIAN
7 | # endif
8 | # else
9 | # define L_LITTLE_ENDIAN
10 | # endif
11 | #endif
12 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/leptonica/leptwin.h:
--------------------------------------------------------------------------------
1 | /*====================================================================*
2 | - Copyright (C) 2001 Leptonica. All rights reserved.
3 | -
4 | - Redistribution and use in source and binary forms, with or without
5 | - modification, are permitted provided that the following conditions
6 | - are met:
7 | - 1. Redistributions of source code must retain the above copyright
8 | - notice, this list of conditions and the following disclaimer.
9 | - 2. Redistributions in binary form must reproduce the above
10 | - copyright notice, this list of conditions and the following
11 | - disclaimer in the documentation and/or other materials
12 | - provided with the distribution.
13 | -
14 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 | - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 | - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | *====================================================================*/
26 |
27 | #ifdef _WIN32
28 | #ifndef LEPTONICA_LEPTWIN_H
29 | #define LEPTONICA_LEPTWIN_H
30 |
31 | #include "allheaders.h"
32 | #include
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif /* __cplusplus */
37 |
38 | LEPT_DLL extern HBITMAP pixGetWindowsHBITMAP( PIX *pixs );
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif /* __cplusplus */
43 |
44 | #endif /* LEPTONICA_LEPTWIN_H */
45 | #endif /* _WIN32 */
46 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/leptonica/stringcode.h:
--------------------------------------------------------------------------------
1 | /*====================================================================*
2 | - Copyright (C) 2001 Leptonica. All rights reserved.
3 | -
4 | - Redistribution and use in source and binary forms, with or without
5 | - modification, are permitted provided that the following conditions
6 | - are met:
7 | - 1. Redistributions of source code must retain the above copyright
8 | - notice, this list of conditions and the following disclaimer.
9 | - 2. Redistributions in binary form must reproduce the above
10 | - copyright notice, this list of conditions and the following
11 | - disclaimer in the documentation and/or other materials
12 | - provided with the distribution.
13 | -
14 | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 | - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 | - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 | - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18 | - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 | - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 | - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 | - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 | - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 | - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | *====================================================================*/
26 |
27 | #ifndef LEPTONICA_STRINGCODE_H
28 | #define LEPTONICA_STRINGCODE_H
29 |
30 | /*!
31 | * \file stringcode.h
32 | *
33 | * Data structure to hold accumulating generated code for storing
34 | * and extracing serializable leptonica objects (e.g., pixa, recog).
35 | *
36 | * Also a flag for selecting a string from the L_GenAssoc struct
37 | * in stringcode.
38 | */
39 |
40 | struct L_StrCode
41 | {
42 | l_int32 fileno; /*!< index for function and output file names */
43 | l_int32 ifunc; /*!< index into struct currently being stored */
44 | SARRAY *function; /*!< store case code for extraction */
45 | SARRAY *data; /*!< store base64 encoded data as strings */
46 | SARRAY *descr; /*!< store line in description table */
47 | l_int32 n; /*!< number of data strings */
48 | };
49 | typedef struct L_StrCode L_STRCODE;
50 |
51 |
52 | /*! Select string in stringcode for a specific serializable data type */
53 | enum {
54 | L_STR_TYPE = 0, /*!< typedef for the data type */
55 | L_STR_NAME = 1, /*!< name of the data type */
56 | L_STR_READER = 2, /*!< reader to get the data type from file */
57 | L_STR_MEMREADER = 3 /*!< reader to get the compressed string in memory */
58 | };
59 |
60 | #endif /* LEPTONICA_STRINGCODE_H */
61 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/apitypes.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: apitypes.h
3 | // Description: Types used in both the API and internally
4 | // Author: Ray Smith
5 | // Created: Wed Mar 03 09:22:53 PST 2010
6 | //
7 | // (C) Copyright 2010, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_API_APITYPES_H_
21 | #define TESSERACT_API_APITYPES_H_
22 |
23 | #include "publictypes.h"
24 |
25 | // The types used by the API and Page/ResultIterator can be found in:
26 | // ccstruct/publictypes.h
27 | // ccmain/resultiterator.h
28 | // ccmain/pageiterator.h
29 | // API interfaces and API users should be sure to include this file, rather
30 | // than the lower-level one, and lower-level code should be sure to include
31 | // only the lower-level file.
32 |
33 | #endif // TESSERACT_API_APITYPES_H_
34 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/basedir.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: basedir.h (Formerly getpath.h)
3 | * Description: Header file for getpath.c. Provides relocatability of data.
4 | * Author: Ray Smith
5 | * Created: Mon Jul 09 09:13:03 BST 1990
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef BASEDIR_H
21 | #define BASEDIR_H
22 |
23 | #include "platform.h"
24 | #include "strngs.h"
25 |
26 | // Returns the given code_path truncated to the last slash.
27 | // Useful for getting to the directory of argv[0], but does not search
28 | // any paths.
29 | TESS_API void truncate_path(const char *code_path, STRING* trunc_path);
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/bits16.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: bits16.h (Formerly bits8.h)
3 | * Description: Code for 8 bit field class.
4 | * Author: Phil Cheatle
5 | * Created: Thu Oct 17 10:10:05 BST 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef BITS16_H
21 | #define BITS16_H
22 |
23 | #include "host.h"
24 |
25 | class DLLSYM BITS16
26 | {
27 | public:
28 | uinT16 val;
29 |
30 | BITS16() {
31 | val = 0;
32 | } // constructor
33 |
34 | BITS16( // constructor
35 | uinT16 init); // initial val
36 |
37 | void turn_on_bit( // flip specified bit
38 | uinT8 bit_num) { // bit to flip 0..7
39 | val = val | 01 << bit_num;
40 | }
41 |
42 | void turn_off_bit( // flip specified bit
43 | uinT8 bit_num) { // bit to flip 0..7
44 | val = val & ~(01 << bit_num);
45 | }
46 |
47 | void set_bit( // flip specified bit
48 | uinT8 bit_num, // bit to flip 0..7
49 | BOOL8 value) { // value to flip to
50 | if (value)
51 | val = val | 01 << bit_num;
52 | else
53 | val = val & ~(01 << bit_num);
54 | }
55 |
56 | BOOL8 bit( // access bit
57 | uinT8 bit_num) const { // bit to access
58 | return (val >> bit_num) & 01;
59 | }
60 | };
61 | #endif
62 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/blckerr.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: blckerr.h (Formerly blockerr.h)
3 | * Description: Error codes for the page block classes.
4 | * Author: Ray Smith
5 | * Created: Tue Mar 19 17:43:30 GMT 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef BLCKERR_H
21 | #define BLCKERR_H
22 |
23 | #include "errcode.h"
24 |
25 | const ERRCODE BADBLOCKLINE = "Y coordinate in block out of bounds";
26 | const ERRCODE LOSTBLOCKLINE = "Can't find rectangle for line";
27 | const ERRCODE ILLEGAL_GRADIENT = "Gradient wrong side of edge step!";
28 | const ERRCODE WRONG_WORD = "Word doesn't have blobs of that type";
29 | #endif
30 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/blobclass.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: blobclass.h
3 | ** Purpose: Interface to high level classification and training.
4 | ** Author: Dan Johnson
5 | ** History: 5/29/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef BLOBCLASS_H
19 | #define BLOBCLASS_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "strngs.h"
25 |
26 | /*---------------------------------------------------------------------------
27 | Macros
28 | ----------------------------------------------------------------------------*/
29 | /* macros for controlling the display of recognized characters */
30 | #define EnableCharDisplay() (DisplayCharacters = TRUE)
31 | #define DisableCharDisplay() (DisplayCharacters = FALSE)
32 |
33 | /* macros for controlling the display of the entire match list */
34 | #define EnableMatchDisplay() (DisplayMatchList = TRUE)
35 | #define DisableMatchDisplay() (DisplayMatchList = FALSE)
36 |
37 | /**----------------------------------------------------------------------------
38 | Public Function Prototypes
39 | ----------------------------------------------------------------------------**/
40 | namespace tesseract {
41 | // Finds the name of the training font and returns it in fontname, by cutting
42 | // it out based on the expectation that the filename is of the form:
43 | // /path/to/dir/[lang].[fontname].exp[num]
44 | // The [lang], [fontname] and [num] fields should not have '.' characters.
45 | // If the global parameter classify_font_name is set, its value is used instead.
46 | void ExtractFontName(const STRING& filename, STRING* fontname);
47 |
48 | } // namespace tesseract.
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/blobgrid.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: blobgrid.h
3 | // Description: BBGrid of BLOBNBOX with useful BLOBNBOX-specific methods.
4 | // Copyright 2011 Google Inc. All Rights Reserved.
5 | // Author: rays@google.com (Ray Smith)
6 | // Created: Sat Jun 11 10:26:01 PST 2011
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 |
21 | #ifndef TESSERACT_TEXTORD_BLOBGRID_H_
22 | #define TESSERACT_TEXTORD_BLOBGRID_H_
23 |
24 | #include "bbgrid.h"
25 | #include "blobbox.h"
26 |
27 | CLISTIZEH(BLOBNBOX)
28 |
29 | namespace tesseract {
30 |
31 | typedef GridSearch BlobGridSearch;
32 |
33 | class BlobGrid : public BBGrid {
34 | public:
35 | BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright);
36 | virtual ~BlobGrid();
37 |
38 | // Inserts all the blobs from the given list, with x and y spreading,
39 | // without removing from the source list, so ownership remains with the
40 | // source list.
41 | void InsertBlobList(BLOBNBOX_LIST* blobs);
42 | };
43 |
44 | } // namespace tesseract.
45 |
46 | #endif // TESSERACT_TEXTORD_BLOBGRID_H_
47 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/blread.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: blread.h (Formerly pdread.h)
3 | * Description: Friend function of BLOCK to read the uscan pd file.
4 | * Author: Ray Smith
5 | * Created: Mon Mar 18 14:39:00 GMT 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef BLREAD_H
21 | #define BLREAD_H
22 |
23 | #include "params.h"
24 | #include "ocrblock.h"
25 |
26 | bool read_unlv_file( //print list of sides
27 | STRING name, //basename of file
28 | inT32 xsize, //image size
29 | inT32 ysize, //image size
30 | BLOCK_LIST *blocks //output list
31 | );
32 | void FullPageBlock(int width, int height, BLOCK_LIST *blocks);
33 | #endif
34 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/ccstruct.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: ccstruct.h
3 | // Description: ccstruct class.
4 | // Author: Samuel Charron
5 | //
6 | // (C) Copyright 2006, Google Inc.
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ///////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef TESSERACT_CCSTRUCT_CCSTRUCT_H_
20 | #define TESSERACT_CCSTRUCT_CCSTRUCT_H_
21 |
22 | #include "cutil.h"
23 |
24 | namespace tesseract {
25 | class CCStruct : public CUtil {
26 | public:
27 | CCStruct();
28 | ~CCStruct();
29 |
30 | // Globally accessible constants.
31 | // APPROXIMATIONS of the fractions of the character cell taken by
32 | // the descenders, ascenders, and x-height.
33 | static const double kDescenderFraction; // = 0.25;
34 | static const double kXHeightFraction; // = 0.5;
35 | static const double kAscenderFraction; // = 0.25;
36 | // Derived value giving the x-height as a fraction of cap-height.
37 | static const double kXHeightCapRatio; // = XHeight/(XHeight + Ascender).
38 | };
39 |
40 | class Tesseract;
41 | } // namespace tesseract
42 |
43 | #endif // TESSERACT_CCSTRUCT_CCSTRUCT_H_
44 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/chop.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: chop.h (Formerly chop.h)
5 | * Description:
6 | * Author: Mark Seaman, SW Productivity
7 | * Created: Fri Oct 16 14:37:00 1987
8 | * Modified: Wed Jul 10 14:47:37 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Reusable Software Component
12 | *
13 | * (c) Copyright 1987, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *******************************************************************************/
25 |
26 | #ifndef CHOP_H
27 | #define CHOP_H
28 |
29 | /*----------------------------------------------------------------------
30 | I n c l u d e s
31 | ----------------------------------------------------------------------*/
32 | #include "genericheap.h"
33 | #include "kdpair.h"
34 | #include "seam.h"
35 |
36 | /*----------------------------------------------------------------------
37 | T y p e s
38 | ---------------------------------------------------------------------*/
39 | #define MAX_NUM_POINTS 50
40 | // The PointPair elements do NOT own the EDGEPTs.
41 | typedef tesseract::KDPairInc PointPair;
42 | typedef tesseract::GenericHeap PointHeap;
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/chopper.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: chopper.h (Formerly chopper.h)
5 | * Description:
6 | * Author: Mark Seaman, SW Productivity
7 | * Created: Fri Oct 16 14:37:00 1987
8 | * Modified: Wed May 15 14:24:26 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Reusable Software Component
12 | *
13 | * (c) Copyright 1987, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 |
26 | #ifndef CHOPPER_H
27 | #define CHOPPER_H
28 |
29 | #include "cutil.h"
30 | #include "matrix.h"
31 | #include "seam.h"
32 | #include "stopper.h"
33 |
34 |
35 | void preserve_outline(EDGEPT *start);
36 |
37 | void preserve_outline_tree(TESSLINE *srcline);
38 |
39 | EDGEPT *restore_outline(EDGEPT *start);
40 |
41 | void restore_outline_tree(TESSLINE *srcline);
42 |
43 | int any_shared_split_points(const GenericVector& seams, SEAM *seam);
44 |
45 | int check_blob(TBLOB *blob);
46 |
47 | inT16 total_containment(TBLOB *blob1, TBLOB *blob2);
48 | #endif
49 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/clusttool.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: clusttool.h
3 | ** Purpose: Definition of clustering utility tools
4 | ** Author: Dan Johnson
5 | ** History: 6/6/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 |
19 | #ifndef TESSERACT_CLASSIFY_CLUSTTOOL_H_
20 | #define TESSERACT_CLASSIFY_CLUSTTOOL_H_
21 |
22 | //--------------------------Include Files---------------------------------------
23 | #include
24 | #include "cluster.h"
25 | #include "host.h"
26 | #include "serialis.h"
27 |
28 | /*-------------------------------------------------------------------------
29 | Public Function Prototype
30 | --------------------------------------------------------------------------*/
31 | uinT16 ReadSampleSize(tesseract::TFile *fp);
32 |
33 | PARAM_DESC *ReadParamDesc(tesseract::TFile *fp, uinT16 N);
34 |
35 | PROTOTYPE *ReadPrototype(tesseract::TFile *fp, uinT16 N);
36 |
37 | PROTOSTYLE ReadProtoStyle(const char *style);
38 |
39 | FLOAT32 *ReadNFloats(tesseract::TFile *fp, uinT16 N, FLOAT32 Buffer[]);
40 |
41 | void WriteParamDesc(FILE *File, uinT16 N, const PARAM_DESC ParamDesc[]);
42 |
43 | void WritePrototype(FILE *File, uinT16 N, PROTOTYPE *Proto);
44 |
45 | void WriteNFloats (FILE * File, uinT16 N, FLOAT32 Array[]);
46 |
47 | void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle);
48 |
49 | void WriteProtoList(FILE *File, uinT16 N, PARAM_DESC ParamDesc[],
50 | LIST ProtoList, BOOL8 WriteSigProtos,
51 | BOOL8 WriteInsigProtos);
52 |
53 | //--------------Global Data Definitions and Declarations---------------------
54 | // define errors that can be trapped
55 | #define ILLEGALSAMPLESIZE 5000
56 | #define ILLEGALCIRCULARSPEC 5001
57 | #define ILLEGALMINMAXSPEC 5002
58 | #define ILLEGALSIGNIFICANCESPEC 5003
59 | #define ILLEGALSTYLESPEC 5004
60 | #define ILLEGALSAMPLECOUNT 5005
61 | #define ILLEGALMEANSPEC 5006
62 | #define ILLEGALVARIANCESPEC 5007
63 | #define ILLEGALDISTRIBUTION 5008
64 | #define ILLEGALFLOAT 5009
65 | #define ILLEGALESSENTIALSPEC 5013
66 | #endif // TESSERACT_CLASSIFY_CLUSTTOOL_H_
67 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/const.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************
2 | ** Licensed under the Apache License, Version 2.0 (the "License");
3 | ** you may not use this file except in compliance with the License.
4 | ** You may obtain a copy of the License at
5 | ** http://www.apache.org/licenses/LICENSE-2.0
6 | ** Unless required by applicable law or agreed to in writing, software
7 | ** distributed under the License is distributed on an "AS IS" BASIS,
8 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 | ** See the License for the specific language governing permissions and
10 | ** limitations under the License.
11 | **************************************************************************/
12 |
13 | #ifndef CONST_H
14 | #define CONST_H
15 |
16 | /*This file contains constants which are global to the entire system*/
17 | #define SPLINESIZE 23 // max spline parts to a line
18 |
19 | #define PI 3.14159265359 // pi
20 |
21 | #define EDGEPTFLAGS 4 // concavity,length etc.
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/control.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: control.h (Formerly control.h)
3 | * Description: Module-independent matcher controller.
4 | * Author: Ray Smith
5 | * Created: Thu Apr 23 11:09:58 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | /**
21 | * @file control.h
22 | * Module-independent matcher controller.
23 | */
24 |
25 | #ifndef CONTROL_H
26 | #define CONTROL_H
27 |
28 | #include "params.h"
29 | #include "ocrblock.h"
30 | #include "ratngs.h"
31 | #include "statistc.h"
32 | #include "pageres.h"
33 |
34 | enum ACCEPTABLE_WERD_TYPE
35 | {
36 | AC_UNACCEPTABLE, ///< Unacceptable word
37 | AC_LOWER_CASE, ///< ALL lower case
38 | AC_UPPER_CASE, ///< ALL upper case
39 | AC_INITIAL_CAP, ///< ALL but initial lc
40 | AC_LC_ABBREV, ///< a.b.c.
41 | AC_UC_ABBREV ///< A.B.C.
42 | };
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/convolve.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: convolve.h
3 | // Description: Convolutional layer that stacks the inputs over its rectangle
4 | // and pulls in random data to fill out-of-input inputs.
5 | // Output is therefore same size as its input, but deeper.
6 | // Author: Ray Smith
7 | // Created: Tue Mar 18 16:45:34 PST 2014
8 | //
9 | // (C) Copyright 2014, Google Inc.
10 | // Licensed under the Apache License, Version 2.0 (the "License");
11 | // you may not use this file except in compliance with the License.
12 | // You may obtain a copy of the License at
13 | // http://www.apache.org/licenses/LICENSE-2.0
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | ///////////////////////////////////////////////////////////////////////
20 |
21 | #ifndef TESSERACT_LSTM_CONVOLVE_H_
22 | #define TESSERACT_LSTM_CONVOLVE_H_
23 |
24 | #include "genericvector.h"
25 | #include "matrix.h"
26 | #include "network.h"
27 |
28 | namespace tesseract {
29 |
30 | // Makes each time-step deeper by stacking inputs over its rectangle. Does not
31 | // affect the size of its input. Achieves this by bringing in random values in
32 | // out-of-input areas.
33 | class Convolve : public Network {
34 | public:
35 | // The area of convolution is 2*half_x + 1 by 2*half_y + 1, forcing it to
36 | // always be odd, so the center is the current pixel.
37 | Convolve(const STRING& name, int ni, int half_x, int half_y);
38 | virtual ~Convolve();
39 |
40 | virtual STRING spec() const {
41 | STRING spec;
42 | spec.add_str_int("C", half_x_ * 2 + 1);
43 | spec.add_str_int(",", half_y_ * 2 + 1);
44 | return spec;
45 | }
46 |
47 | // Writes to the given file. Returns false in case of error.
48 | virtual bool Serialize(TFile* fp) const;
49 | // Reads from the given file. Returns false in case of error.
50 | virtual bool DeSerialize(TFile* fp);
51 |
52 | // Runs forward propagation of activations on the input line.
53 | // See Network for a detailed discussion of the arguments.
54 | virtual void Forward(bool debug, const NetworkIO& input,
55 | const TransposedArray* input_transpose,
56 | NetworkScratch* scratch, NetworkIO* output);
57 |
58 | // Runs backward propagation of errors on the deltas line.
59 | // See Network for a detailed discussion of the arguments.
60 | virtual bool Backward(bool debug, const NetworkIO& fwd_deltas,
61 | NetworkScratch* scratch,
62 | NetworkIO* back_deltas);
63 |
64 | protected:
65 | // Serialized data.
66 | inT32 half_x_;
67 | inT32 half_y_;
68 | };
69 |
70 | } // namespace tesseract.
71 |
72 |
73 | #endif // TESSERACT_LSTM_SUBSAMPLE_H_
74 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/crakedge.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: crakedge.h (Formerly: crkedge.h)
3 | * Description: Sturctures for the Crack following edge detector.
4 | * Author: Ray Smith
5 | * Created: Fri Mar 22 16:06:38 GMT 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef CRAKEDGE_H
21 | #define CRAKEDGE_H
22 |
23 | #include "points.h"
24 | #include "mod128.h"
25 |
26 | class CRACKEDGE {
27 | public:
28 | CRACKEDGE() {}
29 |
30 | ICOORD pos; /*position of crack */
31 | inT8 stepx; //edge step
32 | inT8 stepy;
33 | inT8 stepdir; //chaincode
34 | CRACKEDGE *prev; /*previous point */
35 | CRACKEDGE *next; /*next point */
36 | };
37 | #endif
38 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/cutil_class.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: cutil.h
3 | // Description: cutil class.
4 | // Author: Samuel Charron
5 | //
6 | // (C) Copyright 2006, Google Inc.
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ///////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef TESSERACT_CUTIL_CUTIL_CLASS_H_
20 | #define TESSERACT_CUTIL_CUTIL_CLASS_H_
21 |
22 | #include "ccutil.h"
23 | #include "const.h"
24 | #include "strngs.h"
25 |
26 | namespace tesseract {
27 |
28 | class CUtil : public CCUtil {
29 | public:
30 | CUtil();
31 | ~CUtil();
32 | void read_variables(const char *filename, bool global_only);
33 | };
34 |
35 | } // namespace tesseract
36 |
37 | #endif // TESSERACT_CUTIL_CUTIL_CLASS_H_
38 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/cutoffs.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: cutoffs.h
3 | ** Purpose: Routines to manipulate an array of class cutoffs.
4 | ** Author: Dan Johnson
5 | ** History: Wed Feb 20 09:34:20 1991, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef CUTOFFS_H
19 | #define CUTOFFS_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "matchdefs.h"
25 |
26 | typedef uinT16 CLASS_CUTOFF_ARRAY[MAX_NUM_CLASSES];
27 |
28 | /**----------------------------------------------------------------------------
29 | Public Function Prototypes
30 | ----------------------------------------------------------------------------**/
31 |
32 | /*
33 | #if defined(__STDC__) || defined(__cplusplus)
34 | # define _ARGS(s) s
35 | #else
36 | # define _ARGS(s) ()
37 | #endif*/
38 |
39 | /* cutoffs.c
40 | void ReadNewCutoffs
41 | _ARGS((char *Filename,
42 | CLASS_CUTOFF_ARRAY Cutoffs));
43 | #undef _ARGS
44 | */
45 | #endif
46 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/danerror.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: danerror.h
3 | ** Purpose: Definition of error trapping routines.
4 | ** Author: Dan Johnson
5 | ** History: 4/3/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef DANERROR_H
19 | #define DANERROR_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #define NOERROR 0
25 | #define DO_NOTHING 0
26 |
27 | typedef int TRAPERROR;
28 | typedef void (*VOID_PROC) ();
29 |
30 | /**----------------------------------------------------------------------------
31 | Public Function Prototypes
32 | ----------------------------------------------------------------------------**/
33 | void DoError(int Error, const char *Message);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/dawg_cache.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: dawg_cache.h
3 | // Description: A class that knows about loading and caching dawgs.
4 | // Author: David Eger
5 | // Created: Fri Jan 27 12:08:00 PST 2012
6 | //
7 | // (C) Copyright 2012, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_DICT_DAWG_CACHE_H_
21 | #define TESSERACT_DICT_DAWG_CACHE_H_
22 |
23 | #include "dawg.h"
24 | #include "object_cache.h"
25 | #include "strngs.h"
26 | #include "tessdatamanager.h"
27 |
28 | namespace tesseract {
29 |
30 | class DawgCache {
31 | public:
32 | Dawg *GetSquishedDawg(const STRING &lang, TessdataType tessdata_dawg_type,
33 | int debug_level, TessdataManager *data_file);
34 |
35 | // If we manage the given dawg, decrement its count,
36 | // and possibly delete it if the count reaches zero.
37 | // If dawg is unknown to us, return false.
38 | bool FreeDawg(Dawg *dawg) {
39 | return dawgs_.Free(dawg);
40 | }
41 |
42 | // Free up any currently unused dawgs.
43 | void DeleteUnusedDawgs() {
44 | dawgs_.DeleteUnusedObjects();
45 | }
46 |
47 | private:
48 | ObjectCache dawgs_;
49 | };
50 |
51 | } // namespace tesseract
52 |
53 | #endif // TESSERACT_DICT_DAWG_CACHE_H_
54 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/debugpixa.h:
--------------------------------------------------------------------------------
1 | #ifndef TESSERACT_CCSTRUCT_DEBUGPIXA_H_
2 | #define TESSERACT_CCSTRUCT_DEBUGPIXA_H_
3 |
4 | #include "allheaders.h"
5 |
6 | namespace tesseract {
7 |
8 | // Class to hold a Pixa collection of debug images with captions and save them
9 | // to a PDF file.
10 | class DebugPixa {
11 | public:
12 | // TODO(rays) add another constructor with size control.
13 | DebugPixa() {
14 | pixa_ = pixaCreate(0);
15 | fonts_ = bmfCreate(nullptr, 14);
16 | }
17 | // If the filename_ has been set and there are any debug images, they are
18 | // written to the set filename_.
19 | ~DebugPixa() {
20 | pixaDestroy(&pixa_);
21 | bmfDestroy(&fonts_);
22 | }
23 |
24 | // Adds the given pix to the set of pages in the PDF file, with the given
25 | // caption added to the top.
26 | void AddPix(const Pix* pix, const char* caption) {
27 | int depth = pixGetDepth(const_cast(pix));
28 | int color = depth < 8 ? 1 : (depth > 8 ? 0x00ff0000 : 0x80);
29 | Pix* pix_debug = pixAddSingleTextblock(
30 | const_cast(pix), fonts_, caption, color, L_ADD_BELOW, nullptr);
31 | pixaAddPix(pixa_, pix_debug, L_INSERT);
32 | }
33 |
34 | // Sets the destination filename and enables images to be written to a PDF
35 | // on destruction.
36 | void WritePDF(const char* filename) {
37 | if (pixaGetCount(pixa_) > 0) {
38 | pixaConvertToPdf(pixa_, 300, 1.0f, 0, 0, "AllDebugImages", filename);
39 | pixaClear(pixa_);
40 | }
41 | }
42 |
43 | private:
44 | // The collection of images to put in the PDF.
45 | Pixa* pixa_;
46 | // The fonts used to draw text captions.
47 | L_Bmf* fonts_;
48 | };
49 |
50 | } // namespace tesseract
51 |
52 | #endif // TESSERACT_CCSTRUCT_DEBUGPIXA_H_
53 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/docqual.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * File: docqual.h (Formerly docqual.h)
3 | * Description: Document Quality Metrics
4 | * Author: Phil Cheatle
5 | * Created: Mon May 9 11:27:28 BST 1994
6 | *
7 | * (C) Copyright 1994, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef DOCQUAL_H
21 | #define DOCQUAL_H
22 |
23 | #include "control.h"
24 |
25 | enum GARBAGE_LEVEL
26 | {
27 | G_NEVER_CRUNCH,
28 | G_OK,
29 | G_DODGY,
30 | G_TERRIBLE
31 | };
32 |
33 | inT16 word_blob_quality(WERD_RES *word, ROW *row);
34 | void reject_whole_page(PAGE_RES_IT &page_res_it);
35 | #endif
36 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/dotproductavx.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: dotproductavx.h
3 | // Description: Architecture-specific dot-product function.
4 | // Author: Ray Smith
5 | // Created: Wed Jul 22 10:51:05 PDT 2015
6 | //
7 | // (C) Copyright 2015, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | ///////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef TESSERACT_ARCH_DOTPRODUCTAVX_H_
20 | #define TESSERACT_ARCH_DOTPRODUCTAVX_H_
21 |
22 | namespace tesseract {
23 |
24 | // Computes and returns the dot product of the n-vectors u and v.
25 | // Uses Intel AVX intrinsics to access the SIMD instruction set.
26 | double DotProductAVX(const double* u, const double* v, int n);
27 |
28 | } // namespace tesseract.
29 |
30 | #endif // TESSERACT_ARCH_DOTPRODUCTAVX_H_
31 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/dotproductsse.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: dotproductsse.h
3 | // Description: Architecture-specific dot-product function.
4 | // Author: Ray Smith
5 | // Created: Wed Jul 22 10:57:05 PDT 2015
6 | //
7 | // (C) Copyright 2015, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | ///////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef TESSERACT_ARCH_DOTPRODUCTSSE_H_
20 | #define TESSERACT_ARCH_DOTPRODUCTSSE_H_
21 |
22 | #include "host.h"
23 |
24 | namespace tesseract {
25 |
26 | // Computes and returns the dot product of the n-vectors u and v.
27 | // Uses Intel SSE intrinsics to access the SIMD instruction set.
28 | double DotProductSSE(const double* u, const double* v, int n);
29 | // Computes and returns the dot product of the n-vectors u and v.
30 | // Uses Intel SSE intrinsics to access the SIMD instruction set.
31 | int32_t IntDotProductSSE(const int8_t* u, const int8_t* v, int n);
32 |
33 | } // namespace tesseract.
34 |
35 | #endif // TESSERACT_ARCH_DOTPRODUCTSSE_H_
36 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/drawedg.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: drawedg.h (Formerly drawedge.h)
3 | * Description: Collection of functions to draw things to do with edge
4 | *detection.
5 | * Author: Ray Smith
6 | * Created: Thu Jun 06 13:29:20 BST 1991
7 | *
8 | * (C) Copyright 1991, Hewlett-Packard Ltd.
9 | ** Licensed under the Apache License, Version 2.0 (the "License");
10 | ** you may not use this file except in compliance with the License.
11 | ** You may obtain a copy of the License at
12 | ** http://www.apache.org/licenses/LICENSE-2.0
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | *
19 | **********************************************************************/
20 |
21 | #ifndef DRAWEDG_H
22 | #define DRAWEDG_H
23 | #ifndef GRAPHICS_DISABLED
24 |
25 | #include "scrollview.h"
26 | #include "crakedge.h"
27 |
28 | ScrollView* create_edges_window( //make window
29 | ICOORD page_tr //size of image
30 | );
31 | void draw_raw_edge( //draw the cracks
32 | ScrollView* fd, //window to draw in
33 | CRACKEDGE *start, //start of loop
34 | ScrollView::Color colour //colour to draw in
35 | );
36 | #endif
37 | #endif
38 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/drawfx.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: drawfx.h (Formerly drawfx.h)
3 | * Description: Draw things to do with feature extraction.
4 | * Author: Ray Smith
5 | * Created: Mon Jan 27 11:02:16 GMT 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef DRAWFX_H
21 | #define DRAWFX_H
22 |
23 | #include "params.h"
24 | #include "scrollview.h"
25 |
26 | extern STRING_VAR_H (fx_debugfile, DEBUG_WIN_NAME, "Name of debugfile");
27 | extern ScrollView* fx_win;
28 | extern FILE *fx_debug;
29 | void create_fx_win(); //make features win
30 | void clear_fx_win(); //make features win
31 | void create_fxdebug_win(); //make gradients win
32 | #endif
33 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/edgloop.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: edgloop.h (Formerly edgeloop.h)
3 | * Description: Functions to clean up an outline before approximation.
4 | * Author: Ray Smith
5 | * Created: Tue Mar 26 16:56:25 GMT 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef EDGLOOP_H
21 | #define EDGLOOP_H
22 |
23 | #include "scrollview.h"
24 | #include "params.h"
25 | #include "pdblock.h"
26 | #include "coutln.h"
27 | #include "crakedge.h"
28 |
29 | #define BUCKETSIZE 16
30 |
31 |
32 | extern INT_VAR_H (edges_children_per_grandchild, 10,
33 | "Importance ratio for chucking outlines");
34 | extern INT_VAR_H (edges_children_count_limit, 45,
35 | "Max holes allowed in blob");
36 | extern double_VAR_H (edges_childarea, 0.5,
37 | "Max area fraction of child outline");
38 | extern double_VAR_H (edges_boxarea, 0.8,
39 | "Min area fraction of grandchild for box");
40 | void complete_edge(CRACKEDGE *start, //start of loop
41 | C_OUTLINE_IT* outline_it);
42 | ScrollView::Color check_path_legal( //certify outline
43 | CRACKEDGE *start //start of loop
44 | );
45 | inT16 loop_bounding_box( //get bounding box
46 | CRACKEDGE *&start, //edge loop
47 | ICOORD &botleft, //bounding box
48 | ICOORD &topright);
49 | #endif
50 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/efio.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: efio.h
3 | ** Purpose: Definition of file I/O routines
4 | ** Author: Dan Johnson
5 | ** History: 5/21/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef EFIO_H
19 | #define EFIO_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include
25 |
26 | #define FOPENERROR 3000
27 |
28 | /**----------------------------------------------------------------------------
29 | Public Function Prototype
30 | ----------------------------------------------------------------------------**/
31 | FILE *Efopen(const char *Name, const char *Mode);
32 | #endif
33 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/emalloc.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: emalloc.h
3 | ** Purpose: Definition of memory allocation routines.
4 | ** Author: Dan Johnson
5 | ** History: 4/3/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef EMALLOC_H
19 | #define EMALLOC_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "host.h"
25 | #include "callcpp.h"
26 |
27 | #define NOTENOUGHMEMORY 2000
28 | #define ILLEGALMALLOCREQUEST 2001
29 |
30 | /**----------------------------------------------------------------------------
31 | Public Function Prototypes
32 | ----------------------------------------------------------------------------**/
33 | void *Emalloc(int Size);
34 |
35 | void *Erealloc(void *ptr, int size);
36 |
37 | void Efree(void *ptr);
38 |
39 |
40 | /**----------------------------------------------------------------------------
41 | Global Data Definitions and Declarations
42 | ----------------------------------------------------------------------------**/
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/equationdetectbase.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: equationdetectbase.h
3 | // Description: The base class equation detection class.
4 | // Author: Zongyi (Joe) Liu (joeliu@google.com)
5 | // Created: Fri Aug 31 11:13:01 PST 2011
6 | //
7 | // (C) Copyright 2011, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
21 | #define TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
22 |
23 | class BLOBNBOX_LIST;
24 | class TO_BLOCK;
25 | struct Pix;
26 |
27 | namespace tesseract {
28 |
29 | class ColPartitionGrid;
30 | class ColPartitionSet;
31 |
32 | class EquationDetectBase {
33 | public:
34 | EquationDetectBase();
35 | virtual ~EquationDetectBase();
36 |
37 | // Iterate over the blobs inside to_block, and set the blobs that we want to
38 | // process to BSTT_NONE. (By default, they should be BSTT_SKIP). The function
39 | // returns 0 upon success.
40 | virtual int LabelSpecialText(TO_BLOCK* to_block) = 0;
41 |
42 | // Interface to find possible equation partition grid from part_grid. This
43 | // should be called after IdentifySpecialText function.
44 | virtual int FindEquationParts(ColPartitionGrid* part_grid,
45 | ColPartitionSet** best_columns) = 0;
46 |
47 | // Debug function: Render a bounding box on pix based on the value of its
48 | // special_text_type, specifically:
49 | // BSTT_MATH: red box
50 | // BSTT_DIGIT: cyan box
51 | // BSTT_ITALIC: green box
52 | // BSTT_UNCLEAR: blue box
53 | // All others: yellow box
54 | static void RenderSpecialText(Pix* pix, BLOBNBOX* blob);
55 | };
56 |
57 | }; // namespace tesseract
58 |
59 | #endif // TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
60 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/fileerr.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: fileerr.h (Formerly filerr.h)
3 | * Description: Errors for file utilities.
4 | * Author: Ray Smith
5 | * Created: Tue Aug 14 15:45:16 BST 1990
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef FILEERR_H
21 | #define FILEERR_H
22 |
23 | #include "errcode.h"
24 |
25 | const ERRCODE CANTOPENFILE = "Can't open file";
26 | const ERRCODE CANTCREATEFILE = "Can't create file";
27 | const ERRCODE CANTMAKEPIPE = "Can't create pipe";
28 | const ERRCODE CANTCONNECTPIPE = "Can't reconnect pipes to stdin/stdout";
29 | const ERRCODE READFAILED = "Read of file failed";
30 | const ERRCODE WRITEFAILED = "Write of file failed";
31 | const ERRCODE SELECTFAILED = "Select failed";
32 |
33 | const ERRCODE EXECFAILED = "Could not exec new process";
34 | #endif
35 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/findseam.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: findseam.h (Formerly findseam.h)
5 | * Description:
6 | * Author: Mark Seaman, SW Productivity
7 | * Created: Fri Oct 16 14:37:00 1987
8 | * Modified: Thu May 16 17:05:17 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Reusable Software Component
12 | *
13 | * (c) Copyright 1987, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 |
26 | #ifndef FINDSEAM_H
27 | #define FINDSEAM_H
28 |
29 | /*----------------------------------------------------------------------
30 | I n c l u d e s
31 | ----------------------------------------------------------------------*/
32 | #include "seam.h"
33 | #include "genericheap.h"
34 | #include "kdpair.h"
35 | #include "chop.h"
36 |
37 | // The SeamPair elements own their SEAMs and delete them upon destruction.
38 | typedef tesseract::KDPtrPairInc SeamPair;
39 | typedef tesseract::GenericHeap SeamQueue;
40 |
41 | typedef tesseract::KDPtrPairDec SeamDecPair;
42 | typedef tesseract::GenericHeap SeamPile;
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/fixspace.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * File: fixspace.h (Formerly fixspace.h)
3 | * Description: Implements a pass over the page res, exploring the alternative
4 | * spacing possibilities, trying to use context to improve the
5 | word spacing
6 | * Author: Phil Cheatle
7 | * Created: Thu Oct 21 11:38:43 BST 1993
8 | *
9 | * (C) Copyright 1993, Hewlett-Packard Ltd.
10 | ** Licensed under the Apache License, Version 2.0 (the "License");
11 | ** you may not use this file except in compliance with the License.
12 | ** You may obtain a copy of the License at
13 | ** http://www.apache.org/licenses/LICENSE-2.0
14 | ** Unless required by applicable law or agreed to in writing, software
15 | ** distributed under the License is distributed on an "AS IS" BASIS,
16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | ** See the License for the specific language governing permissions and
18 | ** limitations under the License.
19 | *
20 | **********************************************************************/
21 |
22 | #ifndef FIXSPACE_H
23 | #define FIXSPACE_H
24 |
25 | #include "pageres.h"
26 | #include "params.h"
27 |
28 | void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list);
29 | void transform_to_next_perm(WERD_RES_LIST &words);
30 | void fixspace_dbg(WERD_RES *word);
31 | #endif
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/float2int.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: float2int.h
3 | ** Purpose: Routines for converting float features to int features
4 | ** Author: Dan Johnson
5 | ** History: Wed Mar 13 08:06:41 1991, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef FLOAT2INT_H
19 | #define FLOAT2INT_H
20 |
21 | /*-----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | -----------------------------------------------------------------------------*/
24 | #include "intmatcher.h"
25 | #include "ocrfeatures.h"
26 |
27 | #define INT_FEAT_RANGE 256
28 | #define BASELINE_Y_SHIFT (0.25)
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/fpoint.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: fpoint.h
3 | ** Purpose: Abstract data type for 2D points (floating point coords)
4 | ** Author: Dan Johnson
5 | ** History: Thu Apr 12 10:50:01 1990, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef FPOINT_H
19 | #define FPOINT_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "host.h"
25 | #include
26 | #include
27 |
28 | /* define data structure to hold 2D points or vectors using floating point */
29 | typedef struct
30 | {
31 | FLOAT32 x, y;
32 | } FPOINT;
33 | typedef FPOINT FVECTOR;
34 |
35 | /**----------------------------------------------------------------------------
36 | Macros
37 | ----------------------------------------------------------------------------**/
38 | /* macros for computing miscellaneous functions of 2 points */
39 | #define XDelta(A,B) ( (B).x - (A).x )
40 | #define YDelta(A,B) ( (B).y - (A).y )
41 | #define SlopeFrom(A,B) ( YDelta(A,B) / XDelta(A,B) )
42 | #define AngleFrom(A,B) ( atan2((double) YDelta(A,B), \
43 | (double) XDelta(A,B) ) )
44 |
45 | #define XIntersectionOf(A,B,X) ( SlopeFrom(A,B) * ((X) - A.x) + A.y)
46 |
47 | /*-------------------------------------------------------------------------
48 | Public Function Prototypes
49 | ---------------------------------------------------------------------------*/
50 |
51 | FLOAT32 DistanceBetween(FPOINT A, FPOINT B);
52 |
53 | FLOAT32 NormalizedAngleFrom(FPOINT *Point1, FPOINT *Point2, FLOAT32 FullScale);
54 | #endif
55 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/gap_map.h:
--------------------------------------------------------------------------------
1 | // Licensed under the Apache License, Version 2.0 (the "License");
2 | // you may not use this file except in compliance with the License.
3 | // You may obtain a copy of the License at
4 | // http://www.apache.org/licenses/LICENSE-2.0
5 | // Unless required by applicable law or agreed to in writing, software
6 | // distributed under the License is distributed on an "AS IS" BASIS,
7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | // See the License for the specific language governing permissions and
9 | // limitations under the License.
10 | #ifndef GAP_MAP_H
11 | #define GAP_MAP_H
12 |
13 | #include "blobbox.h"
14 |
15 | class GAPMAP
16 | {
17 | public:
18 | GAPMAP( //constructor
19 | TO_BLOCK *block);
20 |
21 | ~GAPMAP () { //destructor
22 | if (map != NULL)
23 | free_mem(map);
24 | }
25 |
26 | BOOL8 table_gap( //Is gap a table?
27 | inT16 left, //From here
28 | inT16 right); //To here
29 |
30 | private:
31 | inT16 total_rows; //in block
32 | inT16 min_left; //Left extreme
33 | inT16 max_right; //Right extreme
34 | inT16 bucket_size; // half an x ht
35 | inT16 *map; //empty counts
36 | inT16 map_max; //map[0..max_map] defind
37 | BOOL8 any_tabs;
38 | };
39 |
40 | /*-----------------------------*/
41 |
42 | extern BOOL_VAR_H (gapmap_debug, FALSE, "Say which blocks have tables");
43 | extern BOOL_VAR_H (gapmap_use_ends, FALSE,
44 | "Use large space at start and end of rows");
45 | extern BOOL_VAR_H (gapmap_no_isolated_quanta, FALSE,
46 | "Ensure gaps not less than 2quanta wide");
47 | extern double_VAR_H (gapmap_big_gaps, 1.75, "xht multiplier");
48 | #endif
49 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/genblob.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: genblob.h (Formerly gblob.h)
3 | * Description: Generic Blob processing routines
4 | * Author: Phil Cheatle
5 | * Created: Mon Nov 25 10:53:26 GMT 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef GENBLOB_H
21 | #define GENBLOB_H
22 |
23 | // Sort function to sort blobs by ascending left edge.
24 | int c_blob_comparator(const void *blob1p, // ptr to ptr to blob1
25 | const void *blob2p);
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/gettimeofday.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: gettimeofday.h
3 | // Description: Header file for gettimeofday.cpp
4 | // Author: tomp2010, zdenop
5 | // Created: Tue Feb 21 21:38:00 CET 2012
6 | //
7 | // (C) Copyright 2012, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef VS2008_PORT_GETTIMEOFDAY_H_
21 | #define VS2008_PORT_GETTIMEOFDAY_H_
22 |
23 | #ifdef _WIN32
24 | #include // timeval is defined in here.
25 | #endif
26 |
27 | typedef struct timezone tz;
28 |
29 | int gettimeofday(struct timeval * tp, struct timezone * tzp);
30 |
31 | #endif // VS2008_PORT_GETTIMEOFDAY_H_
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/globaloc.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: errcode.h (Formerly error.h)
3 | * Description: Header file for generic error handler class
4 | * Author: Ray Smith
5 | * Created: Tue May 1 16:23:36 BST 1990
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef GLOBALOC_H
21 | #define GLOBALOC_H
22 |
23 | #include "host.h"
24 |
25 | // Saves a clone of the given pix, and notes its resolution in thread-specific
26 | // data, so that the image can be written prior to a crash.
27 | struct Pix;
28 | void SavePixForCrash(int resolution, Pix* pix);
29 |
30 | void signal_exit(int signal_code);
31 |
32 | void err_exit();
33 |
34 | void set_global_loc_code(int loc_code);
35 |
36 | void set_global_subloc_code(int loc_code);
37 |
38 | void set_global_subsubloc_code(int loc_code);
39 | #endif
40 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/globals.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: globals.h (Formerly globals.h)
5 | * Description: Global Variables for Wise Owl
6 | * Author: Mark Seaman, OCR Technology
7 | * Created: Thu Dec 21 11:38:36 1989
8 | * Modified: Thu Jan 4 17:13:00 1990 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Experimental (Do Not Distribute)
12 | *
13 | * (c) Copyright 1989, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 | #ifndef GLOBALS_H
26 | #define GLOBALS_H
27 |
28 | #include "const.h"
29 | #include "unicharset.h"
30 | #include "strngs.h"
31 |
32 | #include
33 |
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/gradechop.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: gradechop.h (Formerly gradechop.h)
5 | * Description:
6 | * Author: Mark Seaman, SW Productivity
7 | * Created: Fri Oct 16 14:37:00 1987
8 | * Modified: Tue Jul 9 16:40:39 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Reusable Software Component
12 | *
13 | * (c) Copyright 1987, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 |
26 | #ifndef GRADECHOP_H
27 | #define GRADECHOP_H
28 |
29 | /*----------------------------------------------------------------------
30 | I n c l u d e s
31 | ----------------------------------------------------------------------*/
32 | #include "seam.h"
33 | #include "ndminx.h"
34 |
35 | /*----------------------------------------------------------------------
36 | M a c r o s
37 | ----------------------------------------------------------------------*/
38 | /**********************************************************************
39 | * partial_split_priority
40 | *
41 | * Assign a priority to this split based on the features that it has.
42 | * Grade it according to the different rating schemes and return the
43 | * value of its goodness.
44 | **********************************************************************/
45 |
46 | #define partial_split_priority(split) \
47 | (grade_split_length (split) + \
48 | grade_sharpness (split)) \
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/host.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: host.h
3 | ** Purpose: This is the system independent typedefs and defines
4 | ** Author: MN, JG, MD
5 | **
6 | ** (c) Copyright Hewlett-Packard Company, 1988-1996.
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | ** http://www.apache.org/licenses/LICENSE-2.0
11 | ** Unless required by applicable law or agreed to in writing, software
12 | ** distributed under the License is distributed on an "AS IS" BASIS,
13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | ** See the License for the specific language governing permissions and
15 | ** limitations under the License.
16 | */
17 |
18 | #ifndef TESSERACT_CCUTIL_HOST_H_
19 | #define TESSERACT_CCUTIL_HOST_H_
20 |
21 | #include
22 | #include "platform.h"
23 | /* _WIN32 */
24 | #ifdef _WIN32
25 | #include
26 | #undef min
27 | #undef max
28 | #endif
29 |
30 | #include // PRId32, ...
31 | #include // int32_t, ...
32 |
33 | // definitions of portable data types (numbers and characters)
34 | typedef int8_t inT8;
35 | typedef uint8_t uinT8;
36 | typedef int16_t inT16;
37 | typedef uint16_t uinT16;
38 | typedef int32_t inT32;
39 | typedef uint32_t uinT32;
40 | typedef int64_t inT64;
41 | typedef uint64_t uinT64;
42 | typedef float FLOAT32;
43 | typedef double FLOAT64;
44 | typedef unsigned char BOOL8;
45 |
46 | #if defined(_WIN32)
47 |
48 | /* MinGW defines the standard PRI... macros, but MSVS doesn't. */
49 |
50 | #if !defined(PRId32)
51 | # define PRId32 "d"
52 | #endif
53 |
54 | #if !defined(PRId64)
55 | # define PRId64 "I64d"
56 | #endif
57 |
58 | #endif /* _WIN32 */
59 |
60 | #define MAX_INT8 0x7f
61 | #define MAX_INT16 0x7fff
62 | #define MAX_INT32 0x7fffffff
63 | #define MAX_UINT8 0xff
64 | #define MAX_UINT16 0xffff
65 | #define MAX_UINT32 0xffffffff
66 | #define MAX_FLOAT32 std::numeric_limits::max()
67 |
68 | #define MIN_INT8 static_cast(0x80)
69 | #define MIN_INT16 static_cast(0x8000)
70 | #define MIN_INT32 static_cast(0x80000000)
71 | #define MIN_UINT8 0x00
72 | #define MIN_UINT16 0x0000
73 | #define MIN_UINT32 0x00000000
74 | // Minimum positive value ie 1e-37ish.
75 | #define MIN_FLOAT32 std::numeric_limits::min()
76 |
77 | // Defines
78 | #ifndef TRUE
79 | #define TRUE 1
80 | #endif
81 |
82 | #ifndef FALSE
83 | #define FALSE 0
84 | #endif
85 |
86 | // Return true if x is within tolerance of y
87 | template bool NearlyEqual(T x, T y, T tolerance) {
88 | T diff = x - y;
89 | return diff <= tolerance && -diff <= tolerance;
90 | }
91 |
92 | #endif // TESSERACT_CCUTIL_HOST_H_
93 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/hpdsizes.h:
--------------------------------------------------------------------------------
1 | // Licensed under the Apache License, Version 2.0 (the "License");
2 | // you may not use this file except in compliance with the License.
3 | // You may obtain a copy of the License at
4 | // http://www.apache.org/licenses/LICENSE-2.0
5 | // Unless required by applicable law or agreed to in writing, software
6 | // distributed under the License is distributed on an "AS IS" BASIS,
7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | // See the License for the specific language governing permissions and
9 | // limitations under the License.
10 | #ifndef HPDSIZES_H
11 | #define HPDSIZES_H
12 |
13 | #define NUM_TEXT_ATTR 10
14 | #define NUM_BLOCK_ATTR 7
15 | #define MAXLENGTH 128
16 | #define NUM_BACKGROUNDS 8
17 | #endif
18 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/icuerrorcode.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: icuerrorcode.h
3 | * Description: Wrapper class for UErrorCode, with conversion operators for
4 | * direct use in ICU C and C++ APIs.
5 | * Author: Fredrik Roubert
6 | * Created: Thu July 4 2013
7 | *
8 | * Features:
9 | * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR,
10 | * removing one common source of errors.
11 | * - Same use in C APIs taking a UErrorCode* (pointer) and C++ taking
12 | * UErrorCode& (reference), via conversion operators.
13 | * - Automatic checking for success when it goes out of scope. On failure,
14 | * the destructor will log an error message and exit.
15 | *
16 | * Most of ICU will handle errors gracefully and provide sensible fallbacks.
17 | * Using IcuErrorCode, it is therefore possible to write very compact code
18 | * that does sensible things on failure and provides logging for debugging.
19 | *
20 | * Example:
21 | * IcuErrorCode icuerrorcode;
22 | * return collator.compareUTF8(a, b, icuerrorcode) == UCOL_EQUAL;
23 | *
24 | * (C) Copyright 2013, Google Inc.
25 | * Licensed under the Apache License, Version 2.0 (the "License");
26 | * you may not use this file except in compliance with the License.
27 | * You may obtain a copy of the License at
28 | * http://www.apache.org/licenses/LICENSE-2.0
29 | * Unless required by applicable law or agreed to in writing, software
30 | * distributed under the License is distributed on an "AS IS" BASIS,
31 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32 | * See the License for the specific language governing permissions and
33 | * limitations under the License.
34 | *
35 | **********************************************************************/
36 | #ifndef TESSERACT_CCUTIL_ICUERRORCODE_H_
37 | #define TESSERACT_CCUTIL_ICUERRORCODE_H_
38 |
39 | #include "tprintf.h"
40 | #include "unicode/errorcode.h" // From libicu
41 |
42 | namespace tesseract {
43 |
44 | class IcuErrorCode : public icu::ErrorCode {
45 | public:
46 | IcuErrorCode() {}
47 | virtual ~IcuErrorCode() {
48 | if (isFailure()) {
49 | handleFailure();
50 | }
51 | }
52 |
53 | protected:
54 | virtual void handleFailure() const {
55 | tprintf("ICU ERROR: %s", errorName());
56 | exit(errorCode);
57 | }
58 |
59 | private:
60 | // Disallow implicit copying of object.
61 | IcuErrorCode(const IcuErrorCode&);
62 | void operator=(const IcuErrorCode&);
63 | };
64 |
65 | } // namespace tesseract
66 | #endif // TESSERACT_CCUTIL_ICUERRORCODE_H_
67 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/ligature_table.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: ligature_table.h
3 | * Description: Class for adding and removing optional latin ligatures,
4 | * conditional on codepoint support by a specified font
5 | * (if specified).
6 | * Author: Ranjith Unnikrishnan
7 | * Created: Mon Nov 18 2013
8 | *
9 | * (C) Copyright 2013, Google Inc.
10 | * Licensed under the Apache License, Version 2.0 (the "License");
11 | * you may not use this file except in compliance with the License.
12 | * You may obtain a copy of the License at
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | **********************************************************************/
21 |
22 | #ifndef TRAININGDATA_LIGATURE_TABLE_H_
23 | #define TRAININGDATA_LIGATURE_TABLE_H_
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include "util.h"
30 |
31 | namespace tesseract {
32 |
33 | class PangoFontInfo; // defined in pango_font_info.h
34 |
35 | // Map to substitute strings for ligatures.
36 | typedef std::unordered_map LigHash;
37 |
38 | class LigatureTable {
39 | public:
40 | // Get a static instance of this class.
41 | static LigatureTable* Get();
42 |
43 | // Convert the utf8 string so that ligaturizable sequences, such as "fi" get
44 | // replaced by the (utf8 code for) appropriate ligature characters. Only do so
45 | // if the corresponding ligature character is renderable in the current font.
46 | string AddLigatures(const string& str, const PangoFontInfo* font) const;
47 | // Remove all ligatures.
48 | string RemoveLigatures(const string& str) const;
49 | // Remove only custom ligatures (eg. "ct") encoded in the private-use-area.
50 | string RemoveCustomLigatures(const string& str) const;
51 |
52 | const LigHash& norm_to_lig_table() const {
53 | return norm_to_lig_table_;
54 | }
55 | const LigHash& lig_to_norm_table() const {
56 | return lig_to_norm_table_;
57 | }
58 |
59 | protected:
60 | LigatureTable();
61 | // Initialize the hash tables mapping between ligature strings and the
62 | // corresponding ligature characters.
63 | void Init();
64 |
65 | static std::unique_ptr instance_;
66 | LigHash norm_to_lig_table_;
67 | LigHash lig_to_norm_table_;
68 | int min_lig_length_;
69 | int max_lig_length_;
70 | int min_norm_length_;
71 | int max_norm_length_;
72 |
73 | private:
74 | LigatureTable(const LigatureTable&);
75 | void operator=(const LigatureTable&);
76 | };
77 |
78 | } // namespace tesseract
79 |
80 | #endif // OCR_TRAININGDATA_TYPESETTING_LIGATURE_TABLE_H_
81 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/lsterr.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: lsterr.h (Formerly listerr.h)
3 | * Description: Errors shared by list modules
4 | * Author: Phil Cheatle
5 | * Created: Wed Jan 23 09:10:35 GMT 1991
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSERACT_CCUTIL_LSTERR_H_
21 | #define TESSERACT_CCUTIL_LSTERR_H_
22 |
23 | #include "errcode.h" //must be last include
24 |
25 | const ERRCODE DONT_CONSTRUCT_LIST_BY_COPY =
26 | "Can't create a list by assignment";
27 | const ERRCODE DONT_ASSIGN_LISTS = "Can't assign to lists";
28 | const ERRCODE SERIALISE_LINKS = "Attempted to (de)serialise a link element";
29 |
30 | #ifndef NDEBUG
31 |
32 | const ERRCODE NO_LIST = "Iterator not set to a list";
33 | const ERRCODE NULL_OBJECT = "List found this = NULL!";
34 | const ERRCODE NULL_DATA = "List would have returned a NULL data pointer";
35 | const ERRCODE NULL_CURRENT = "List current position is NULL";
36 | const ERRCODE NULL_NEXT = "Next element on the list is NULL";
37 | const ERRCODE NULL_PREV = "Previous element on the list is NULL";
38 | const ERRCODE EMPTY_LIST = "List is empty";
39 | const ERRCODE BAD_PARAMETER = "List parameter error";
40 | const ERRCODE STILL_LINKED =
41 | "Attempting to add an element with non NULL links, to a list";
42 |
43 | #endif // !NDEBUG
44 | #endif // TESSERACT_CCUTIL_LSTERR_H_
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/mathfix.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: mathfix.h
3 | // Description: Implement missing math functions
4 | // Author: zdenop
5 | // Created: Fri Feb 03 06:45:06 CET 2012
6 | //
7 | // (C) Copyright 2012, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef VS2008_INCLUDE_MATHFIX_H_
21 | #define VS2008_INCLUDE_MATHFIXT_H_
22 |
23 | #ifndef _MSC_VER
24 | #error "Use this header only with Microsoft Visual C++ compilers!"
25 | #endif
26 |
27 | #include
28 | #include // for _isnan(), _finite() on VC++
29 |
30 | #if _MSC_VER < 1800
31 | #define isnan(x) _isnan(x)
32 | #define isinf(x) (!_finite(x))
33 | #define fmax max //VC++ does not implement all the provisions of C99 Standard
34 | #define round(x) roundf(x)
35 | inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); }
36 | #endif
37 |
38 | #endif // VS2008_INCLUDE_MATHFIXT_H_
39 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/maxpool.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: maxpool.h
3 | // Description: Standard Max-Pooling layer.
4 | // Author: Ray Smith
5 | // Created: Tue Mar 18 16:28:18 PST 2014
6 | //
7 | // (C) Copyright 2014, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | ///////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef TESSERACT_LSTM_MAXPOOL_H_
20 | #define TESSERACT_LSTM_MAXPOOL_H_
21 |
22 | #include "reconfig.h"
23 |
24 | namespace tesseract {
25 |
26 | // Maxpooling reduction. Independently for each input, selects the location
27 | // in the rectangle that contains the max value.
28 | // Backprop propagates only to the position that was the max.
29 | class Maxpool : public Reconfig {
30 | public:
31 | Maxpool(const STRING& name, int ni, int x_scale, int y_scale);
32 | virtual ~Maxpool();
33 |
34 | // Accessors.
35 | virtual STRING spec() const {
36 | STRING spec;
37 | spec.add_str_int("Mp", y_scale_);
38 | spec.add_str_int(",", x_scale_);
39 | return spec;
40 | }
41 |
42 | // Reads from the given file. Returns false in case of error.
43 | virtual bool DeSerialize(TFile* fp);
44 |
45 | // Runs forward propagation of activations on the input line.
46 | // See Network for a detailed discussion of the arguments.
47 | virtual void Forward(bool debug, const NetworkIO& input,
48 | const TransposedArray* input_transpose,
49 | NetworkScratch* scratch, NetworkIO* output);
50 |
51 | // Runs backward propagation of errors on the deltas line.
52 | // See Network for a detailed discussion of the arguments.
53 | virtual bool Backward(bool debug, const NetworkIO& fwd_deltas,
54 | NetworkScratch* scratch,
55 | NetworkIO* back_deltas);
56 |
57 | private:
58 | // Memory of which input was the max.
59 | GENERIC_2D_ARRAY maxes_;
60 | };
61 |
62 |
63 | } // namespace tesseract.
64 |
65 |
66 |
67 |
68 |
69 | #endif // TESSERACT_LSTM_MAXPOOL_H_
70 |
71 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/memry.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: memry.h (Formerly memory.h)
3 | * Description: Header file for basic memory allocation/deallocation.
4 | * Author: Ray Smith
5 | * Created: Tue May 8 16:03:48 BST 1990
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef MEMRY_H
21 | #define MEMRY_H
22 |
23 | #include
24 | #include "host.h"
25 |
26 | // allocate string
27 | extern char *alloc_string(inT32 count);
28 | // free a string.
29 | extern void free_string(char *string);
30 | // get some memory
31 | extern void *alloc_mem(inT32 count);
32 | // get some memory initialized to 0.
33 | extern void *alloc_big_zeros(inT32 count);
34 | // free mem from alloc_mem
35 | extern void free_mem(void *oldchunk);
36 | // free mem from alloc_big_zeros
37 | extern void free_big_mem(void *oldchunk);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/mf.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: mf.h
3 | ** Purpose: Micro-feature interface to flexible feature extractor.
4 | ** Author: Dan Johnson
5 | ** History: Thu May 24 09:39:56 1990, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef MF_H
19 | #define MF_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "ocrfeatures.h"
25 | #include "blobs.h"
26 |
27 | typedef enum {
28 | MFXPosition, MFYPosition,
29 | MFLength, MFDirection, MFBulge1, MFBulge2,
30 | MFCount // For array sizes.
31 | } MF_PARAM_NAME;
32 |
33 | typedef float MicroFeature[MFCount];
34 | /*----------------------------------------------------------------------------
35 | Private Function Prototypes
36 | -----------------------------------------------------------------------------*/
37 | FEATURE_SET ExtractMicros(TBLOB* Blob, const DENORM& cn_denorm);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/mfdefs.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: mfdefs.h
3 | ** Purpose: Definition of micro-features
4 | ** Author: Dan Johnson
5 | ** History: Mon Jan 22 08:42:13 1990, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef MFDEFS_H
19 | #define MFDEFS_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "oldlist.h"
25 | #include "matchdefs.h"
26 |
27 | /* definition of a list of micro-features */
28 | typedef LIST MICROFEATURES;
29 |
30 | /* definition of structure of micro-features */
31 | #define MFSIZE 6
32 | typedef FLOAT32 MFBLOCK[MFSIZE];
33 | typedef FLOAT32 *MICROFEATURE;
34 |
35 | /* definitions of individual micro-feature parameters */
36 | #define XPOSITION 0
37 | #define YPOSITION 1
38 | #define MFLENGTH 2
39 | #define ORIENTATION 3
40 | #define FIRSTBULGE 4
41 | #define SECONDBULGE 5
42 |
43 | /**----------------------------------------------------------------------------
44 | Macros
45 | ----------------------------------------------------------------------------**/
46 |
47 | /* macros for accessing micro-feature lists */
48 | #define NextFeatureOf(L) ( (MICROFEATURE) first_node ( L ) )
49 |
50 | /**----------------------------------------------------------------------------
51 | Public Function Prototypes
52 | ----------------------------------------------------------------------------**/
53 | MICROFEATURE NewMicroFeature();
54 |
55 | void FreeMicroFeatures(MICROFEATURES MicroFeatures);
56 | #endif
57 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/mfx.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: mfx.h
3 | ** Purpose: Definition of micro-feature extraction routines
4 | ** Author: Dan Johnson
5 | ** History: 5/29/89, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef MFX_H
19 | #define MFX_H
20 |
21 | /*----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "mfdefs.h"
25 | #include "params.h"
26 | /*----------------------------------------------------------------------------
27 | Variables
28 | ----------------------------------------------------------------------------**/
29 |
30 | /* old numbers corresponded to 10.0 degrees and 80.0 degrees */
31 | extern double_VAR_H(classify_min_slope, 0.414213562,
32 | "Slope below which lines are called horizontal");
33 | extern double_VAR_H(classify_max_slope, 2.414213562,
34 | "Slope above which lines are called vertical");
35 |
36 | /*----------------------------------------------------------------------------
37 | Public Function Prototypes
38 | ----------------------------------------------------------------------------**/
39 | MICROFEATURES BlobMicroFeatures(TBLOB* Blob, const DENORM& cn_denorm);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/mutableiterator.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: mutableiterator.h
3 | // Description: Iterator for tesseract results providing access to
4 | // both high-level API and Tesseract internal data structures.
5 | // Author: David Eger
6 | // Created: Thu Feb 24 19:01:06 PST 2011
7 | //
8 | // (C) Copyright 2011, Google Inc.
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | ///////////////////////////////////////////////////////////////////////
20 |
21 | #ifndef TESSERACT_CCMAIN_MUTABLEITERATOR_H_
22 | #define TESSERACT_CCMAIN_MUTABLEITERATOR_H_
23 |
24 | #include "resultiterator.h"
25 |
26 | class BLOB_CHOICE_IT;
27 |
28 | namespace tesseract {
29 |
30 | class Tesseract;
31 |
32 | // Class to iterate over tesseract results, providing access to all levels
33 | // of the page hierarchy, without including any tesseract headers or having
34 | // to handle any tesseract structures.
35 | // WARNING! This class points to data held within the TessBaseAPI class, and
36 | // therefore can only be used while the TessBaseAPI class still exists and
37 | // has not been subjected to a call of Init, SetImage, Recognize, Clear, End
38 | // DetectOS, or anything else that changes the internal PAGE_RES.
39 | // See apitypes.h for the definition of PageIteratorLevel.
40 | // See also base class PageIterator, which contains the bulk of the interface.
41 | // ResultIterator adds text-specific methods for access to OCR output.
42 | // MutableIterator adds access to internal data structures.
43 |
44 | class MutableIterator : public ResultIterator {
45 | public:
46 | // See argument descriptions in ResultIterator()
47 | MutableIterator(PAGE_RES* page_res, Tesseract* tesseract,
48 | int scale, int scaled_yres,
49 | int rect_left, int rect_top,
50 | int rect_width, int rect_height)
51 | : ResultIterator(
52 | LTRResultIterator(page_res, tesseract, scale, scaled_yres, rect_left,
53 | rect_top, rect_width, rect_height)) {}
54 | virtual ~MutableIterator() {}
55 |
56 | // See PageIterator and ResultIterator for most calls.
57 |
58 | // Return access to Tesseract internals.
59 | const PAGE_RES_IT *PageResIt() const { return it_; }
60 | };
61 |
62 | } // namespace tesseract.
63 |
64 | #endif // TESSERACT_CCMAIN_MUTABLEITERATOR_H_
65 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/ndminx.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: ndminx.h (Formerly ndminmax.h)
3 | * Description: Extended ascii chars
4 | * Author: Phil Cheatle
5 | * Created: Mon Mar 29 14:46:01 BST 1993
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef NDMINX_H
21 | #define NDMINX_H
22 |
23 | #ifndef MAX
24 | #define MAX(x,y) (((x) >= (y))?(x):(y))
25 | #endif
26 |
27 | #ifndef MIN
28 | #define MIN(x,y) (((x) <= (y))?(x):(y))
29 | #endif
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/normfeat.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: normfeat.h
3 | ** Purpose: Definition of character normalization features.
4 | ** Author: Dan Johnson
5 | ** History: 12/14/90, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef NORMFEAT_H
19 | #define NORMFEAT_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "ocrfeatures.h"
25 |
26 | #define LENGTH_COMPRESSION (10.0)
27 |
28 | typedef enum {
29 | CharNormY, CharNormLength, CharNormRx, CharNormRy
30 | } NORM_PARAM_NAME;
31 |
32 | /**----------------------------------------------------------------------------
33 | Public Function Prototypes
34 | ----------------------------------------------------------------------------**/
35 | FLOAT32 ActualOutlineLength(FEATURE Feature);
36 |
37 | FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT& fx_info);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/normmatch.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: normmatch.h
3 | ** Purpose: Simple matcher based on character normalization features.
4 | ** Author: Dan Johnson
5 | ** History: Thu Dec 20 08:55:05 1990, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef NORMMATCH_H
19 | #define NORMMATCH_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "matchdefs.h"
25 | #include "ocrfeatures.h"
26 | #include "params.h"
27 |
28 | /**----------------------------------------------------------------------------
29 | Variables
30 | ----------------------------------------------------------------------------**/
31 |
32 | /* control knobs used to control the normalization adjustment process */
33 | extern double_VAR_H(classify_norm_adj_midpoint, 32.0,
34 | "Norm adjust midpoint ...");
35 | extern double_VAR_H(classify_norm_adj_curl, 2.0, "Norm adjust curl ...");
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/opencl_device_selection.h:
--------------------------------------------------------------------------------
1 | // Licensed under the Apache License, Version 2.0 (the "License");
2 | // you may not use this file except in compliance with the License.
3 | // You may obtain a copy of the License at
4 | // http://www.apache.org/licenses/LICENSE-2.0
5 | // Unless required by applicable law or agreed to in writing, software
6 | // distributed under the License is distributed on an "AS IS" BASIS,
7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | // See the License for the specific language governing permissions and
9 | // limitations under the License.
10 |
11 | #ifndef DEVICE_SELECTION_H
12 | #define DEVICE_SELECTION_H
13 |
14 | #ifdef USE_OPENCL
15 |
16 | #ifdef _MSC_VER
17 | #define _CRT_SECURE_NO_WARNINGS
18 | #endif
19 |
20 | #include
21 | #include
22 | #include
23 |
24 | #ifdef __APPLE__
25 | #include
26 | #else
27 | #include
28 | #endif
29 |
30 | // device type
31 | typedef enum {
32 | DS_DEVICE_NATIVE_CPU = 0,
33 | DS_DEVICE_OPENCL_DEVICE
34 | } ds_device_type;
35 |
36 | typedef struct {
37 | ds_device_type type;
38 | cl_device_id oclDeviceID;
39 | char* oclDeviceName;
40 | char* oclDriverVersion;
41 | // a pointer to the score data, the content/format is application defined.
42 | void* score;
43 | } ds_device;
44 |
45 | #endif // USE_OPENCL
46 | #endif // DEVICE_SELECTION_H
47 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/otsuthr.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: otsuthr.h
3 | // Description: Simple Otsu thresholding for binarizing images.
4 | // Author: Ray Smith
5 | // Created: Fri Mar 07 12:14:01 PST 2008
6 | //
7 | // (C) Copyright 2008, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_CCMAIN_OTSUTHR_H_
21 | #define TESSERACT_CCMAIN_OTSUTHR_H_
22 |
23 | struct Pix;
24 |
25 | namespace tesseract {
26 |
27 | const int kHistogramSize = 256; // The size of a histogram of pixel values.
28 |
29 | // Computes the Otsu threshold(s) for the given image rectangle, making one
30 | // for each channel. Each channel is always one byte per pixel.
31 | // Returns an array of threshold values and an array of hi_values, such
32 | // that a pixel value >threshold[channel] is considered foreground if
33 | // hi_values[channel] is 0 or background if 1. A hi_value of -1 indicates
34 | // that there is no apparent foreground. At least one hi_value will not be -1.
35 | // Delete thresholds and hi_values with delete [] after use.
36 | // The return value is the number of channels in the input image, being
37 | // the size of the output thresholds and hi_values arrays.
38 | int OtsuThreshold(Pix* src_pix, int left, int top, int width, int height,
39 | int** thresholds, int** hi_values);
40 |
41 | // Computes the histogram for the given image rectangle, and the given
42 | // single channel. Each channel is always one byte per pixel.
43 | // Histogram is always a kHistogramSize(256) element array to count
44 | // occurrences of each pixel value.
45 | void HistogramRect(Pix* src_pix, int channel,
46 | int left, int top, int width, int height,
47 | int* histogram);
48 |
49 | // Computes the Otsu threshold(s) for the given histogram.
50 | // Also returns H = total count in histogram, and
51 | // omega0 = count of histogram below threshold.
52 | int OtsuStats(const int* histogram, int* H_out, int* omega0_out);
53 |
54 | } // namespace tesseract.
55 |
56 | #endif // TESSERACT_CCMAIN_OTSUTHR_H_
57 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/outfeat.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: outfeat.h
3 | ** Purpose: Definition of outline features.
4 | ** Author: Dan Johnson
5 | ** History: 11/13/90, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef OUTFEAT_H
19 | #define OUTFEAT_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "ocrfeatures.h"
25 | #include "fpoint.h"
26 | #include "mfoutline.h"
27 |
28 | typedef enum {
29 | OutlineFeatX,
30 | OutlineFeatY,
31 | OutlineFeatLength,
32 | OutlineFeatDir
33 | } OUTLINE_FEAT_PARAM_NAME;
34 |
35 | #define MAX_OUTLINE_FEATURES (100)
36 |
37 | /*---------------------------------------------------------------------------
38 | Privat Function Prototypes
39 | ----------------------------------------------------------------------------*/
40 | void AddOutlineFeatureToSet(FPOINT *Start,
41 | FPOINT *End,
42 | FEATURE_SET FeatureSet);
43 |
44 | void ConvertToOutlineFeatures(MFOUTLINE Outline, FEATURE_SET FeatureSet);
45 |
46 | void NormalizeOutlineX(FEATURE_SET FeatureSet);
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/output.h:
--------------------------------------------------------------------------------
1 | /******************************************************************
2 | * File: output.h (Formerly output.h)
3 | * Description: Output pass
4 | * Author: Phil Cheatle
5 | * Created: Thu Aug 4 10:56:08 BST 1994
6 | *
7 | * (C) Copyright 1994, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef OUTPUT_H
21 | #define OUTPUT_H
22 |
23 | #include "params.h"
24 | //#include "epapconv.h"
25 | #include "pageres.h"
26 |
27 | /** test line ends */
28 | char determine_newline_type(WERD *word, ///< word to do
29 | BLOCK *block, ///< current block
30 | WERD *next_word, ///< next word
31 | BLOCK *next_block ///< block of next word
32 | );
33 | #endif
34 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/picofeat.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: picofeat.h
3 | ** Purpose: Definition of pico features.
4 | ** Author: Dan Johnson
5 | ** History: 9/4/90, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef PICOFEAT_H
19 | #define PICOFEAT_H
20 |
21 | /**----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------**/
24 | #include "ocrfeatures.h"
25 | #include "params.h"
26 |
27 | // Enum for the order/type of params in IntFeatDesc.
28 | enum IntParams {
29 | IntX, // x-position (0-255).
30 | IntY, // y-position (0-255).
31 | IntDir // Direction (0-255, circular).
32 | };
33 |
34 | // Enum for the order/type of params in GeoFeatDesc.
35 | enum GeoParams {
36 | GeoBottom, // Bounding box bottom in baseline space (0-255).
37 | GeoTop, // Bounding box top in baseline space (0-255).
38 | GeoWidth, // Bounding box width in baseline space (0-255).
39 |
40 | GeoCount // Number of geo features.
41 | };
42 |
43 | typedef enum
44 | { PicoFeatY, PicoFeatDir, PicoFeatX }
45 | PICO_FEAT_PARAM_NAME;
46 |
47 | #define MAX_PICO_FEATURES (1000)
48 |
49 | /*---------------------------------------------------------------------------
50 | Variables
51 | ----------------------------------------------------------------------------*/
52 |
53 | extern double_VAR_H(classify_pico_feature_length, 0.05, "Pico Feature Length");
54 |
55 |
56 | /**----------------------------------------------------------------------------
57 | Public Function Prototypes
58 | ----------------------------------------------------------------------------**/
59 | #define GetPicoFeatureLength() (PicoFeatureLength)
60 |
61 | /**----------------------------------------------------------------------------
62 | Global Data Definitions and Declarations
63 | ----------------------------------------------------------------------------**/
64 | extern TESS_API FLOAT32 PicoFeatureLength;
65 | #endif
66 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/platform.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: platform.h
3 | // Description: Place holder
4 | // Author:
5 | // Created:
6 | //
7 | // (C) Copyright 2006, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_CCUTIL_PLATFORM_H_
21 | #define TESSERACT_CCUTIL_PLATFORM_H_
22 |
23 | #include
24 |
25 | #define DLLSYM
26 | #ifdef _WIN32
27 | #ifndef NOMINMAX
28 | #define NOMINMAX
29 | #endif /* NOMINMAX */
30 | #ifndef WIN32_LEAN_AND_MEAN
31 | #define WIN32_LEAN_AND_MEAN
32 | #endif
33 | #ifdef __GNUC__
34 | #define ultoa _ultoa
35 | #endif /* __GNUC__ */
36 | #define SIGNED
37 | #if defined(_MSC_VER)
38 | #if (_MSC_VER < 1900)
39 | #define snprintf _snprintf
40 | #endif
41 | #if (_MSC_VER <= 1400)
42 | #define vsnprintf _vsnprintf
43 | #endif /* (_MSC_VER <= 1400) */
44 | #endif /* defined(_MSC_VER) */
45 | #else
46 | #define __UNIX__
47 | #include
48 | #ifndef PATH_MAX
49 | #define MAX_PATH 4096
50 | #else
51 | #define MAX_PATH PATH_MAX
52 | #endif
53 | #define SIGNED signed
54 | #endif
55 |
56 | #if defined(_WIN32) || defined(__CYGWIN__)
57 | #ifndef M_PI
58 | #define M_PI 3.14159265358979323846
59 | #endif
60 | #endif
61 |
62 | #if defined(_WIN32) || defined(__CYGWIN__)
63 | #if defined(TESS_EXPORTS)
64 | #define TESS_API __declspec(dllexport)
65 | #elif defined(TESS_IMPORTS)
66 | #define TESS_API __declspec(dllimport)
67 | #else
68 | #define TESS_API
69 | #endif
70 | #define TESS_LOCAL
71 | #else
72 | #if __GNUC__ >= 4
73 | #if defined(TESS_EXPORTS) || defined(TESS_IMPORTS)
74 | #define TESS_API __attribute__ ((visibility ("default")))
75 | #define TESS_LOCAL __attribute__ ((visibility ("hidden")))
76 | #else
77 | #define TESS_API
78 | #define TESS_LOCAL
79 | #endif
80 | #else
81 | #define TESS_API
82 | #define TESS_LOCAL
83 | #endif
84 | #endif
85 |
86 | #endif // TESSERACT_CCUTIL_PLATFORM_H_
87 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/plotedges.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: plotedges.h (Formerly plotedges.h)
5 | * Description: Convert the various data type into line lists
6 | * Author: Mark Seaman, OCR Technology
7 | * Created: Fri Jul 28 13:14:48 1989
8 | * Modified: Mon May 13 09:34:51 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Experimental (Do Not Distribute)
12 | *
13 | * (c) Copyright 1989, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 | #ifndef PLOTEDGES_H
26 | #define PLOTEDGES_H
27 |
28 | #include "callcpp.h"
29 | #include "oldlist.h"
30 | #include "blobs.h"
31 |
32 | /*----------------------------------------------------------------------
33 | V a r i a b l e s
34 | ----------------------------------------------------------------------*/
35 | extern ScrollView *edge_window; /* Window for edges */
36 |
37 | /*----------------------------------------------------------------------
38 | Macros
39 | ----------------------------------------------------------------------*/
40 | /**********************************************************************
41 | * update_edge_window
42 | *
43 | * Refresh the display of the edge window.
44 | **********************************************************************/
45 | #define update_edge_window() \
46 | if (wordrec_display_splits) { \
47 | c_make_current (edge_window); \
48 | } \
49 |
50 |
51 | /**********************************************************************
52 | * edge_window_wait
53 | *
54 | * Wait for someone to click in the edges window.
55 | **********************************************************************/
56 |
57 | #define edge_window_wait() \
58 | if (wordrec_display_splits) window_wait (edge_window)
59 |
60 | /*----------------------------------------------------------------------
61 | F u n c t i o n s
62 | ---------------------------------------------------------------------*/
63 | void display_edgepts(LIST outlines);
64 |
65 | void draw_blob_edges(TBLOB *blob);
66 |
67 | void mark_outline(EDGEPT *edgept);
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/polyaprx.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: polyaprx.h (Formerly polygon.h)
3 | * Description: Code for polygonal approximation from old edgeprog.
4 | * Author: Ray Smith
5 | * Created: Thu Nov 25 11:42:04 GMT 1993
6 | *
7 | * (C) Copyright 1993, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef POLYAPRX_H
21 | #define POLYAPRX_H
22 |
23 | #include "blobs.h"
24 | #include "coutln.h"
25 |
26 | // convert a chain-coded input to the old OUTLINE approximation
27 | TESSLINE* ApproximateOutline(bool allow_detailed_fx, C_OUTLINE *c_outline);
28 | EDGEPT *edgesteps_to_edgepts ( //convert outline
29 | C_OUTLINE * c_outline, //input
30 | EDGEPT edgepts[] //output is array
31 | );
32 | void fix2( //polygonal approx
33 | EDGEPT *start, /*loop to approimate */
34 | int area);
35 | EDGEPT *poly2( //second poly
36 | EDGEPT *startpt, /*start of loop */
37 | int area /*area of blob box */
38 | );
39 | void cutline( //recursive refine
40 | EDGEPT *first, /*ends of line */
41 | EDGEPT *last,
42 | int area /*area of object */
43 | );
44 | #endif
45 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/quadlsq.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: quadlsq.h (Formerly qlsq.h)
3 | * Description: Code for least squares approximation of quadratics.
4 | * Author: Ray Smith
5 | * Created: Wed Oct 6 15:14:23 BST 1993
6 | *
7 | * (C) Copyright 1993, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef QUADLSQ_H
21 | #define QUADLSQ_H
22 |
23 | #include "points.h"
24 |
25 | class QLSQ
26 | {
27 | public:
28 | QLSQ() { //constructor
29 | clear(); //set to zeros
30 | }
31 | void clear(); //initialize
32 |
33 | void add( //add element
34 | double x, //coords to add
35 | double y);
36 | void remove( //delete element
37 | double x, //coords to delete
38 | double y);
39 | inT32 count() { //no of elements
40 | return n;
41 | }
42 |
43 | void fit( //fit the given
44 | int degree); //return actual
45 | double get_a() { //get x squard
46 | return a;
47 | }
48 | double get_b() { //get x squard
49 | return b;
50 | }
51 | double get_c() { //get x squard
52 | return c;
53 | }
54 |
55 | private:
56 | inT32 n; //no of elements
57 | double a, b, c; //result
58 | double sigx; //sum of x
59 | double sigy; //sum of y
60 | double sigxx; //sum x squared
61 | double sigxy; //sum of xy
62 | double sigyy; //sum y squared
63 | long double sigxxx; //sum x cubed
64 | long double sigxxy; //sum xsquared y
65 | long double sigxxxx; //sum x fourth
66 | };
67 | #endif
68 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/quadratc.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: quadratc.h (Formerly quadrtic.h)
3 | * Description: Code for the QUAD_COEFFS class.
4 | * Author: Ray Smith
5 | * Created: Tue Oct 08 17:24:40 BST 1991
6 | *
7 | * (C) Copyright 1991, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef QUADRATC_H
21 | #define QUADRATC_H
22 |
23 | #include "points.h"
24 |
25 | class QUAD_COEFFS
26 | {
27 | public:
28 | QUAD_COEFFS() {
29 | } //empty constructor
30 | QUAD_COEFFS( //constructor
31 | double xsq, //coefficients
32 | float x,
33 | float constant) {
34 | a = xsq;
35 | b = x;
36 | c = constant;
37 | }
38 |
39 | float y( //evaluate
40 | float x) const { //at x
41 | return (float) ((a * x + b) * x + c);
42 | }
43 |
44 | void move( // reposition word
45 | ICOORD vec) { // by vector
46 | /************************************************************
47 | y - q = a (x - p)^2 + b (x - p) + c
48 | y - q = ax^2 - 2apx + ap^2 + bx - bp + c
49 | y = ax^2 + (b - 2ap)x + (c - bp + ap^2 + q)
50 | ************************************************************/
51 | inT16 p = vec.x ();
52 | inT16 q = vec.y ();
53 |
54 | c = (float) (c - b * p + a * p * p + q);
55 | b = (float) (b - 2 * a * p);
56 | }
57 |
58 | double a; //x squared
59 | float b; //x
60 | float c; //constant
61 | private:
62 | };
63 | #endif
64 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/reject.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: reject.h (Formerly reject.h)
3 | * Description: Rejection functions used in tessedit
4 | * Author: Phil Cheatle
5 | * Created: Wed Sep 23 16:50:21 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef REJECT_H
21 | #define REJECT_H
22 |
23 | #include "params.h"
24 | #include "pageres.h"
25 |
26 | void reject_blanks(WERD_RES *word);
27 | void reject_poor_matches(WERD_RES *word);
28 | float compute_reject_threshold(WERD_CHOICE* word);
29 | BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths);
30 | void dont_allow_1Il(WERD_RES *word);
31 | void flip_hyphens(WERD_RES *word);
32 | void flip_0O(WERD_RES *word);
33 | BOOL8 non_0_digit(const char* str, int length);
34 | #endif
35 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/render.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: render.h (Formerly render.h)
5 | * Description: Convert the various data type into line lists
6 | * Author: Mark Seaman, OCR Technology
7 | * Created: Fri Jul 28 13:14:48 1989
8 | * Modified: Fri Apr 26 09:59:45 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Experimental (Do Not Distribute)
12 | *
13 | * (c) Copyright 1989, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 | #ifndef RENDER_H
26 | #define RENDER_H
27 |
28 | #include "host.h"
29 | #include "callcpp.h"
30 | #include "blobs.h"
31 |
32 | /*----------------------------------------------------------------------
33 | V a r i a b l e s
34 | ----------------------------------------------------------------------*/
35 | extern ScrollView *blob_window; /* Window for blobs */
36 | extern C_COL color_list[]; /* Colors for outlines */
37 |
38 | extern BOOL_VAR_H(wordrec_display_all_blobs, 0, "Display Blobs");
39 |
40 | extern BOOL_VAR_H(wordrec_display_all_words, 0, "Display Words");
41 |
42 | extern BOOL_VAR_H(wordrec_blob_pause, 0, "Blob pause");
43 |
44 | #define NUM_COLORS 6
45 |
46 | /*----------------------------------------------------------------------
47 | F u n c t i o n s
48 | ----------------------------------------------------------------------*/
49 | void display_blob(TBLOB *blob, C_COL color);
50 |
51 | void render_blob(void *window, TBLOB *blob, C_COL color);
52 |
53 | void render_edgepts(void *window, EDGEPT *edgept, C_COL color);
54 |
55 | void render_outline(void *window,
56 | TESSLINE *outline,
57 | C_COL color);
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by tesseract.rc
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | // Unless required by applicable law or agreed to in writing, software
9 | // distributed under the License is distributed on an "AS IS" BASIS,
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | // See the License for the specific language governing permissions and
12 | // limitations under the License.
13 |
14 | // Next default values for new objects
15 | //
16 | #ifdef APSTUDIO_INVOKED
17 | #ifndef APSTUDIO_READONLY_SYMBOLS
18 | #define _APS_NEXT_RESOURCE_VALUE 101
19 | #define _APS_NEXT_COMMAND_VALUE 40001
20 | #define _APS_NEXT_CONTROL_VALUE 1001
21 | #define _APS_NEXT_SYMED_VALUE 101
22 | #endif
23 | #endif
24 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/scanutils.h:
--------------------------------------------------------------------------------
1 | // Copyright 2006 Google Inc.
2 | // All Rights Reserved.
3 | // Author: renn
4 | //
5 | // Contains file io functions (mainly for file parsing), that might not be
6 | // available, on embedded devices, or that have an incomplete implementation
7 | // there.
8 | //
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 |
19 | #ifndef TESSERACT_CCUTIL_SCANUTILS_H_
20 | #define TESSERACT_CCUTIL_SCANUTILS_H_
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | /**
28 | * fscanf variant to ensure correct reading regardless of locale.
29 | *
30 | * tfscanf parse a file stream according to the given format. See the fscanf
31 | * manpage for more information, as this function attempts to mimic its
32 | * behavior.
33 | *
34 | * @note Note that scientific floating-point notation is not supported.
35 | *
36 | */
37 | int tfscanf(FILE* stream, const char *format, ...);
38 |
39 | #ifdef EMBEDDED
40 |
41 | // Attempts to parse the given file stream s as an integer of the base
42 | // 'base'. Returns the first successfully parsed integer as a uintmax_t, or
43 | // 0, if none was found.
44 | uintmax_t streamtoumax(FILE* s, int base);
45 |
46 | // Parse a file stream according to the given format. See the fscanf manpage
47 | // for more information, as this function attempts to mimic its behavior.
48 | // Note that scientific loating-point notation is not supported.
49 | int fscanf(FILE* stream, const char *format, ...);
50 |
51 | // Parse a file stream according to the given format. See the fscanf manpage
52 | // for more information, as this function attempts to mimic its behavior.
53 | // Note that scientific loating-point notation is not supported.
54 | int vfscanf(FILE* stream, const char *format, va_list ap);
55 |
56 | // Create a file at the specified path. See the creat manpage for more
57 | // information, as this function attempts to mimic its behavior.
58 | int creat(const char *pathname, mode_t mode);
59 |
60 | // Convert the specified C-String to a float. Returns the first parsed float,
61 | // or 0.0 if no floating point value could be found. Note that scientific
62 | // floating-point notation is not supported.
63 | double strtofloat(const char* s);
64 |
65 | #endif // EMBEDDED
66 |
67 | #endif // TESSERACT_CCUTIL_SCANUTILS_H_
68 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/simddetect.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: simddetect.h
3 | // Description: Architecture detector.
4 | // Author: Stefan Weil (based on code from Ray Smith)
5 | //
6 | // (C) Copyright 2014, Google Inc.
7 | // Licensed under the Apache License, Version 2.0 (the "License");
8 | // you may not use this file except in compliance with the License.
9 | // You may obtain a copy of the License at
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | ///////////////////////////////////////////////////////////////////////
17 |
18 | #include "platform.h"
19 |
20 | // Architecture detector. Add code here to detect any other architectures for
21 | // SIMD-based faster dot product functions. Intended to be a single static
22 | // object, but it does no real harm to have more than one.
23 | class SIMDDetect {
24 | public:
25 | // Returns true if AVX is available on this system.
26 | static inline bool IsAVXAvailable() { return detector.avx_available_; }
27 | // Returns true if SSE4.1 is available on this system.
28 | static inline bool IsSSEAvailable() { return detector.sse_available_; }
29 |
30 | private:
31 | // Constructor, must set all static member variables.
32 | SIMDDetect();
33 |
34 | private:
35 | // Singleton.
36 | static SIMDDetect detector;
37 | // If true, then AVX has been detected.
38 | static TESS_API bool avx_available_;
39 | // If true, then SSe4.1 has been detected.
40 | static TESS_API bool sse_available_;
41 | };
42 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/sortflts.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: sortflts.h (Formerly sfloats.h)
3 | * Description: Code to maintain a sorted list of floats.
4 | * Author: Ray Smith
5 | * Created: Mon Oct 4 16:15:40 BST 1993
6 | *
7 | * (C) Copyright 1993, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef SORTFLTS_H
21 | #define SORTFLTS_H
22 |
23 | #include "elst.h"
24 |
25 | class SORTED_FLOAT:public ELIST_LINK
26 | {
27 | friend class SORTED_FLOATS;
28 |
29 | public:
30 | SORTED_FLOAT() {
31 | } //empty constructor
32 | SORTED_FLOAT( //create one
33 | float value, //value of entry
34 | inT32 key) { //reference
35 | entry = value;
36 | address = key;
37 | }
38 | private:
39 | float entry; //value of float
40 | inT32 address; //key
41 | };
42 |
43 | ELISTIZEH (SORTED_FLOAT)
44 | class SORTED_FLOATS
45 | {
46 | public:
47 | /** empty constructor */
48 | SORTED_FLOATS() {
49 | it.set_to_list (&list);
50 | }
51 | /**
52 | * add sample
53 | * @param value sample float
54 | * @param key retrieval key
55 | */
56 | void add(float value,
57 | inT32 key);
58 | /**
59 | * delete sample
60 | * @param key key to delete
61 | */
62 | void remove(inT32 key);
63 | /**
64 | * index to list
65 | * @param index item to get
66 | */
67 | float operator[] (inT32 index);
68 |
69 | private:
70 | SORTED_FLOAT_LIST list; //list of floats
71 | SORTED_FLOAT_IT it; //iterator built-in
72 | };
73 | #endif
74 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/stderr.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: stderr.h (Formerly stderrs.h)
3 | * Description: File defining error messages fundamental of commonly used.
4 | * Author: Ray Smith
5 | * Created: Fri Aug 10 15:23:14 BST 1990
6 | *
7 | * (C) Copyright 1990, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef STDERR_H
21 | #define STDERR_H
22 |
23 | #include "errcode.h"
24 |
25 | const ERRCODE MEMORY_OUT = "Out of memory";
26 | #endif
27 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/stopper.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | ** Filename: stopper.h
3 | ** Purpose: Stopping criteria for word classifier.
4 | ** Author: Dan Johnson
5 | ** History: Wed May 1 09:42:57 1991, DSJ, Created.
6 | **
7 | ** (c) Copyright Hewlett-Packard Company, 1988.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | ******************************************************************************/
18 | #ifndef STOPPER_H
19 | #define STOPPER_H
20 |
21 | /*----------------------------------------------------------------------------
22 | Include Files and Type Defines
23 | ----------------------------------------------------------------------------*/
24 |
25 | #include "genericvector.h"
26 | #include "params.h"
27 | #include "ratngs.h"
28 | #include "unichar.h"
29 |
30 | class WERD_CHOICE;
31 |
32 | typedef uinT8 BLOB_WIDTH;
33 |
34 | struct DANGERR_INFO {
35 | DANGERR_INFO() :
36 | begin(-1), end(-1), dangerous(false), correct_is_ngram(false),
37 | leftmost(INVALID_UNICHAR_ID) {}
38 | DANGERR_INFO(int b, int e, bool d, bool n, UNICHAR_ID l) :
39 | begin(b), end(e), dangerous(d), correct_is_ngram(n), leftmost(l) {}
40 | int begin;
41 | int end;
42 | bool dangerous;
43 | bool correct_is_ngram;
44 | UNICHAR_ID leftmost; // in the replacement, what's the leftmost character?
45 | };
46 |
47 | typedef GenericVector DANGERR;
48 |
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/strtok_r.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: strtok_r.h
3 | // Description: Header file for strtok_r.cpp
4 | // source: https://github.com/heimdal/heimdal/blob/master/lib/roken/
5 | // strtok_r.c
6 | // Author: zdenop
7 | // Created: Fri Aug 12 23:55:06 CET 2011
8 | //
9 | // (C) Copyright 2011, Google Inc.
10 | // Licensed under the Apache License, Version 2.0 (the "License");
11 | // you may not use this file except in compliance with the License.
12 | // You may obtain a copy of the License at
13 | // http://www.apache.org/licenses/LICENSE-2.0
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 | ///////////////////////////////////////////////////////////////////////
21 |
22 | #ifndef VS2010_PORT_STRTOK_R_H_
23 | #define VS2010_PORT_STRTOK_R_H_
24 |
25 | char *strtok_r(char *s1, const char *s2, char **lasts);
26 |
27 | #endif // VS2010_PORT_STRTOK_R_H_
28 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tessbox.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tessbox.h (Formerly tessbox.h)
3 | * Description: Black boxed Tess for developing a resaljet.
4 | * Author: Ray Smith
5 | * Created: Thu Apr 23 11:03:36 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSBOX_H
21 | #define TESSBOX_H
22 |
23 | #include "ratngs.h"
24 | #include "tesseractclass.h"
25 |
26 | // TODO(ocr-team): Delete this along with other empty header files.
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tessedit.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tessedit.h (Formerly tessedit.h)
3 | * Description: Main program for merge of tess and editor.
4 | * Author: Ray Smith
5 | * Created: Tue Jan 07 15:21:46 GMT 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSEDIT_H
21 | #define TESSEDIT_H
22 |
23 | #include "blobs.h"
24 | #include "pgedit.h"
25 |
26 | //progress monitor
27 | extern ETEXT_DESC *global_monitor;
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tessopt.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: getopt.h
3 | * Description: Re-implementation of the unix code.
4 | * Author: Ray Smith
5 | * Created: Tue Nov 28 05:52:50 MST 1995
6 | *
7 | * (C) Copyright 1995, Hewlett-Packard Co.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSERACT_TRAINING_TESSOPT_H_
21 | #define TESSERACT_TRAINING_TESSOPT_H_
22 |
23 | #include "host.h"
24 |
25 | extern int tessoptind;
26 | extern char *tessoptarg;
27 |
28 | int tessopt ( //parse args
29 | inT32 argc, //arg count
30 | char *argv[], //args
31 | const char *arglist //string of arg chars
32 | );
33 |
34 | #endif // TESSERACT_TRAINING_TESSOPT_H_
35 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tessvars.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tessvars.h (Formerly tessvars.h)
3 | * Description: Variables and other globals for tessedit.
4 | * Author: Ray Smith
5 | * Created: Mon Apr 13 13:13:23 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSVARS_H
21 | #define TESSVARS_H
22 |
23 | #include
24 |
25 |
26 | extern FILE *debug_fp; // write debug stuff here
27 | #endif
28 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tlog.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tlog.h
3 | * Description: Variant of printf with logging level controllable by a
4 | * commandline flag.
5 | * Author: Ranjith Unnikrishnan
6 | * Created: Wed Nov 20 2013
7 | *
8 | * (C) Copyright 2013, Google Inc.
9 | ** Licensed under the Apache License, Version 2.0 (the "License");
10 | ** you may not use this file except in compliance with the License.
11 | ** You may obtain a copy of the License at
12 | ** http://www.apache.org/licenses/LICENSE-2.0
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | *
19 | **********************************************************************/
20 | #ifndef TESSERACT_TRAINING_TLOG_H_
21 | #define TESSERACT_TRAINING_TLOG_H_
22 |
23 | #include "commandlineflags.h"
24 | #include "errcode.h"
25 | #include "tprintf.h"
26 |
27 | DECLARE_INT_PARAM_FLAG(tlog_level);
28 |
29 | // Variant guarded by the numeric logging level parameter FLAGS_tlog_level
30 | // (default 0). Code using ParseCommandLineFlags() can control its value using
31 | // the --tlog_level commandline argument. Otherwise it must be specified in a
32 | // config file like other params.
33 | #define tlog(level, ...) { \
34 | if (FLAGS_tlog_level >= level) { \
35 | tprintf_internal(__VA_ARGS__); \
36 | } \
37 | }
38 |
39 | #define TLOG_IS_ON(level) (FLAGS_tlog_level >= level)
40 |
41 | #endif // TESSERACT_TRAINING_TLOG_H_
42 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tordmain.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tordmain.h (Formerly textordp.h)
3 | * Description: C++ top level textord code.
4 | * Author: Ray Smith
5 | * Created: Tue Jul 28 17:12:33 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TORDMAIN_H
21 | #define TORDMAIN_H
22 |
23 | #include
24 | #include "params.h"
25 | #include "ocrblock.h"
26 | #include "blobs.h"
27 | #include "blobbox.h"
28 |
29 | struct Pix;
30 | namespace tesseract {
31 | class Tesseract;
32 |
33 | void SetBlobStrokeWidth(Pix* pix, BLOBNBOX* blob);
34 | void assign_blobs_to_blocks2(Pix* pix, BLOCK_LIST *blocks,
35 | TO_BLOCK_LIST *port_blocks);
36 | } // namespace tesseract
37 |
38 | void tweak_row_baseline(ROW *row,
39 | double blshift_maxshift,
40 | double blshift_xfraction);
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/tprintf.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: tprintf.h
3 | * Description: Trace version of printf - portable between UX and NT
4 | * Author: Phil Cheatle
5 | * Created: Wed Jun 28 15:01:15 BST 1995
6 | *
7 | * (C) Copyright 1995, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSERACT_CCUTIL_TPRINTF_H
21 | #define TESSERACT_CCUTIL_TPRINTF_H
22 |
23 | #include "params.h"
24 |
25 | extern DLLSYM STRING_VAR_H(debug_file, "",
26 | "File to send tprintf output to");
27 | extern DLLSYM BOOL_VAR_H(debug_window_on, TRUE,
28 | "Send tprintf to window unless file set");
29 |
30 | // Main logging function.
31 | #define tprintf(...) tprintf_internal(__VA_ARGS__)
32 |
33 | extern TESS_API void tprintf_internal( // Trace printf
34 | const char *format, ...); // Message
35 |
36 | #endif // define TESSERACT_CCUTIL_TPRINTF_H
37 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/underlin.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: underlin.h (Formerly undrline.h)
3 | * Description: Code to chop blobs apart from underlines.
4 | * Author: Ray Smith
5 | * Created: Mon Aug 8 11:14:00 BST 1994
6 | *
7 | * (C) Copyright 1994, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef UNDERLIN_H
21 | #define UNDERLIN_H
22 |
23 | #include "fpchop.h"
24 |
25 | extern double_VAR_H (textord_underline_offset, 0.1,
26 | "Fraction of x to ignore");
27 | extern BOOL_VAR_H (textord_restore_underlines, FALSE,
28 | "Chop underlines & put back");
29 | void restore_underlined_blobs( //get chop points
30 | TO_BLOCK *block //block to do
31 | );
32 | TO_ROW *most_overlapping_row( //find best row
33 | TO_ROW_LIST *rows, //list of rows
34 | BLOBNBOX *blob //blob to place
35 | );
36 | void find_underlined_blobs( //get chop points
37 | BLOBNBOX *u_line, //underlined unit
38 | QSPLINE *baseline, //actual baseline
39 | float xheight, //height of line
40 | float baseline_offset, //amount to shrinke it
41 | ICOORDELT_LIST *chop_cells //places to chop
42 | );
43 | void vertical_cunderline_projection( //project outlines
44 | C_OUTLINE *outline, //outline to project
45 | QSPLINE *baseline, //actual baseline
46 | float xheight, //height of line
47 | float baseline_offset, //amount to shrinke it
48 | STATS *lower_proj, //below baseline
49 | STATS *middle_proj, //centre region
50 | STATS *upper_proj //top region
51 | );
52 | #endif
53 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/unicharset_training_utils.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: unicharset_training_utils.h
3 | // Description: Training utilities for UNICHARSET.
4 | // Author: Ray Smith
5 | // Created: Fri Oct 17 17:14:01 PDT 2014
6 | //
7 | // (C) Copyright 2014, Google Inc.
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | // http://www.apache.org/licenses/LICENSE-2.0
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | ///////////////////////////////////////////////////////////////////////
19 |
20 | #ifndef TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_
21 | #define TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_
22 |
23 | #include
24 |
25 | #ifdef USE_STD_NAMESPACE
26 | using std::string;
27 | #endif
28 |
29 | class STATS;
30 | class UNICHARSET;
31 |
32 | namespace tesseract {
33 |
34 | // Helper sets the character attribute properties and sets up the script table.
35 | // Does not set tops and bottoms.
36 | void SetupBasicProperties(bool report_errors, bool decompose,
37 | UNICHARSET* unicharset);
38 | // Default behavior is to compose, until it is proven that decomposed benefits
39 | // at least one language.
40 | inline void SetupBasicProperties(bool report_errors, UNICHARSET* unicharset) {
41 | SetupBasicProperties(report_errors, false, unicharset);
42 | }
43 |
44 | // Helper to set the properties for an input unicharset file, writes to the
45 | // output file. If an appropriate script unicharset can be found in the
46 | // script_dir directory, then the tops and bottoms are expanded using the
47 | // script unicharset.
48 | // If non-empty, xheight data for the fonts are written to the xheights_file.
49 | void SetPropertiesForInputFile(const string& script_dir,
50 | const string& input_unicharset_file,
51 | const string& output_unicharset_file,
52 | const string& output_xheights_file);
53 |
54 | } // namespace tesseract.
55 |
56 | #endif // TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_
57 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/unicodes.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: unicodes.h
3 | * Description: Unicode related machinery
4 | * Author: David Eger
5 | * Created: Wed Jun 15 16:37:50 PST 2011
6 | *
7 | * (C) Copyright 2011, Google, Inc.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSERACT_CCUTIL_UNICODES_H_
21 | #define TESSERACT_CCUTIL_UNICODES_H_
22 |
23 | namespace tesseract {
24 |
25 | extern const char *kUTF8LineSeparator;
26 | extern const char *kUTF8ParagraphSeparator;
27 | extern const char *kLRM; //< Left-to-Right Mark
28 | extern const char *kRLM; //< Right-to-Left Mark
29 | extern const char *kRLE; //< Right-to-Left Embedding
30 | extern const char *kPDF; //< Pop Directional Formatting
31 |
32 | /// The following are confusable internal word punctuation symbols
33 | /// which we normalize to the first variant when matching in dawgs.
34 | extern const char *kHyphenLikeUTF8[];
35 | extern const char *kApostropheLikeUTF8[];
36 |
37 | } // namespace
38 |
39 | #endif // TESSERACT_CCUTIL_UNICODES_H_
40 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/universalambigs.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////
2 | // File: universalambigs.h
3 | // Description: Data for a universal ambigs file that is useful for
4 | // any language.
5 | // Author: Ray Smith
6 | // Created: Mon Mar 18 11:26:00 PDT 2013
7 | //
8 | // (C) Copyright 2013, Google Inc.
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | // Unless required by applicable law or agreed to in writing, software
14 | // distributed under the License is distributed on an "AS IS" BASIS,
15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | // See the License for the specific language governing permissions and
17 | // limitations under the License.
18 | //
19 | ///////////////////////////////////////////////////////////////////////
20 |
21 | #ifndef TESSERACT_CCUTIL_UNIVERSALAMBIGS_H_
22 | #define TESSERACT_CCUTIL_UNIVERSALAMBIGS_H_
23 |
24 | namespace tesseract {
25 |
26 | extern const char kUniversalAmbigsFile[];
27 | extern const int ksizeofUniversalAmbigsFile;
28 |
29 | } // namespace tesseract
30 |
31 | #endif // TESSERACT_CCUTIL_UNIVERSALAMBIGS_H_
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/util.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: util.h
3 | * Description: Misc STL string utility functions.
4 | * Author: Samuel Charron
5 | * Created: Mon Nov 18 2013
6 | *
7 | * (C) Copyright 2013, Google Inc.
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef TESSERACT_TRAINING_UTIL_H_
21 | #define TESSERACT_TRAINING_UTIL_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | #ifdef USE_STD_NAMESPACE
29 | using std::string;
30 | using std::vector;
31 | #endif
32 |
33 | // StringHash is the hashing functor needed by the stl hash map.
34 | #ifndef COMPILER_MSVC
35 | struct StringHash {
36 | size_t operator()(const string& s) const {
37 | size_t hash_code = 0;
38 | const char* str = s.c_str();
39 | for (int ch = 0; str[ch] != 0; ++ch) {
40 | hash_code += str[ch] << (ch % 24);
41 | }
42 | return hash_code;
43 | }
44 | };
45 | #else // COMPILER_MSVC
46 | struct StringHash : public stdext::hash_compare {
47 | size_t operator()(const string& s) const {
48 | size_t hash_code = 0;
49 | const char* str = s.c_str();
50 | for (int ch = 0; str[ch] != 0; ++ch) {
51 | hash_code += str[ch] << (ch % 24);
52 | }
53 | return hash_code;
54 | }
55 | bool operator()(const string& s1, const string& s2) const {
56 | return s1 == s2;
57 | }
58 | };
59 | #endif // !COMPILER_MSVC
60 |
61 | #ifndef USE_STD_NAMESPACE
62 | #include "base/heap-checker.h"
63 | #define DISABLE_HEAP_LEAK_CHECK HeapLeakChecker::Disabler disabler
64 | #else
65 | #define DISABLE_HEAP_LEAK_CHECK {}
66 | #endif
67 |
68 | #endif // TESSERACT_TRAINING_UTIL_H_
69 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/vcsversion.h:
--------------------------------------------------------------------------------
1 | // Licensed under the Apache License, Version 2.0 (the "License");
2 | // you may not use this file except in compliance with the License.
3 | // You may obtain a copy of the License at
4 | // http://www.apache.org/licenses/LICENSE-2.0
5 | // Unless required by applicable law or agreed to in writing, software
6 | // distributed under the License is distributed on an "AS IS" BASIS,
7 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 | // See the License for the specific language governing permissions and
9 | // limitations under the License.
10 | #define GIT_REV "4.00.00dev"
11 |
12 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/vecfuncs.h:
--------------------------------------------------------------------------------
1 | /* -*-C-*-
2 | ********************************************************************************
3 | *
4 | * File: vecfuncs.h (Formerly vecfuncs.h)
5 | * Description: Vector calculations
6 | * Author: Mark Seaman, OCR Technology
7 | * Created: Wed Dec 20 09:37:18 1989
8 | * Modified: Tue Jul 9 17:44:37 1991 (Mark Seaman) marks@hpgrlt
9 | * Language: C
10 | * Package: N/A
11 | * Status: Experimental (Do Not Distribute)
12 | *
13 | * (c) Copyright 1989, Hewlett-Packard Company.
14 | ** Licensed under the Apache License, Version 2.0 (the "License");
15 | ** you may not use this file except in compliance with the License.
16 | ** You may obtain a copy of the License at
17 | ** http://www.apache.org/licenses/LICENSE-2.0
18 | ** Unless required by applicable law or agreed to in writing, software
19 | ** distributed under the License is distributed on an "AS IS" BASIS,
20 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | ** See the License for the specific language governing permissions and
22 | ** limitations under the License.
23 | *
24 | *********************************************************************************/
25 | #ifndef VECFUNCS_H
26 | #define VECFUNCS_H
27 |
28 | #include
29 |
30 | struct EDGEPT;
31 |
32 | /*----------------------------------------------------------------------
33 | M a c r o s
34 | ----------------------------------------------------------------------*/
35 | /**********************************************************************
36 | * point_diff
37 | *
38 | * Return the difference from point (p1) to point (p2). Put the value
39 | * into point (p).
40 | **********************************************************************/
41 |
42 | #define point_diff(p,p1,p2) \
43 | ((p).x = (p1).x - (p2).x, \
44 | (p).y = (p1).y - (p2).y)
45 |
46 | /**********************************************************************
47 | * CROSS
48 | *
49 | * cross product
50 | **********************************************************************/
51 |
52 | #define CROSS(a,b) \
53 | ((a).x * (b).y - (a).y * (b).x)
54 |
55 | /**********************************************************************
56 | * SCALAR
57 | *
58 | * scalar vector product
59 | **********************************************************************/
60 |
61 | #define SCALAR(a,b) \
62 | ((a).x * (b).x + (a).y * (b).y)
63 |
64 | /**********************************************************************
65 | * LENGTH
66 | *
67 | * length of vector
68 | **********************************************************************/
69 |
70 | #define LENGTH(a) \
71 | ((a).x * (a).x + (a).y * (a).y)
72 |
73 | /*----------------------------------------------------------------------
74 | F u n c t i o n s
75 | ----------------------------------------------------------------------*/
76 | int direction(EDGEPT *point);
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Private/Header/tesseract/werdit.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 | * File: wordit.c
3 | * Description: An iterator for passing over all the words in a document.
4 | * Author: Ray Smith
5 | * Created: Mon Apr 27 08:51:22 BST 1992
6 | *
7 | * (C) Copyright 1992, Hewlett-Packard Ltd.
8 | ** Licensed under the Apache License, Version 2.0 (the "License");
9 | ** you may not use this file except in compliance with the License.
10 | ** You may obtain a copy of the License at
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | ** Unless required by applicable law or agreed to in writing, software
13 | ** distributed under the License is distributed on an "AS IS" BASIS,
14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ** See the License for the specific language governing permissions and
16 | ** limitations under the License.
17 | *
18 | **********************************************************************/
19 |
20 | #ifndef WERDIT_H
21 | #define WERDIT_H
22 |
23 | #include "pageres.h"
24 |
25 | PAGE_RES_IT* make_pseudo_word(PAGE_RES* page_res, const TBOX& selection_box);
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Category/NSString+SS.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+SS.h
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/4/27.
6 | //
7 |
8 | #import
9 |
10 | @interface NSString (SS)
11 |
12 | + (NSString *)ss_removeSpaceAndNewline:(NSString *)str;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Category/NSString+SS.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+SS.m
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/4/27.
6 | //
7 |
8 | #import "NSString+SS.h"
9 |
10 | @implementation NSString (SS)
11 |
12 | + (NSString *)ss_removeSpaceAndNewline:(NSString *)str {
13 | if (str == nil) return str;
14 | NSString *tempStr = [str stringByReplacingOccurrencesOfString:@" " withString:@""];
15 | tempStr = [tempStr stringByReplacingOccurrencesOfString:@"\r" withString:@""];
16 | tempStr = [tempStr stringByReplacingOccurrencesOfString:@"\n" withString:@""];
17 | return tempStr;
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Category/UIView+SS.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+SS.h
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/5/3.
6 | //
7 |
8 | #import
9 |
10 | @interface UIView (SS)
11 |
12 | @property (nonatomic) CGFloat ss_left; ///< Shortcut for frame.origin.x.
13 | @property (nonatomic) CGFloat ss_top; ///< Shortcut for frame.origin.y
14 | @property (nonatomic) CGFloat ss_right; ///< Shortcut for frame.origin.x + frame.size.width
15 | @property (nonatomic) CGFloat ss_bottom; ///< Shortcut for frame.origin.y + frame.size.height
16 | @property (nonatomic) CGFloat ss_width; ///< Shortcut for frame.size.width.
17 | @property (nonatomic) CGFloat ss_height; ///< Shortcut for frame.size.height.
18 | @property (nonatomic) CGFloat ss_centerX; ///< Shortcut for center.x
19 | @property (nonatomic) CGFloat ss_centerY; ///< Shortcut for center.y
20 | @property (nonatomic) CGPoint ss_origin; ///< Shortcut for frame.origin.
21 | @property (nonatomic) CGSize ss_size; ///< Shortcut for frame.size.
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Category/UIView+SS.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+SS.m
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/5/3.
6 | //
7 |
8 | #import "UIView+SS.h"
9 |
10 | @implementation UIView (SS)
11 |
12 | - (CGFloat)ss_left {
13 | return self.frame.origin.x;
14 | }
15 |
16 | - (void)setSs_left:(CGFloat)ss_left {
17 | CGRect frame = self.frame;
18 | frame.origin.x = ss_left;
19 | self.frame = frame;
20 | }
21 |
22 | - (CGFloat)ss_top {
23 | return self.frame.origin.y;
24 | }
25 |
26 | - (void)setSs_top:(CGFloat)ss_top {
27 | CGRect frame = self.frame;
28 | frame.origin.y = ss_top;
29 | self.frame = frame;
30 | }
31 |
32 | - (CGFloat)ss_right {
33 | return self.frame.origin.x + self.frame.size.width;
34 | }
35 |
36 | - (void)setSs_right:(CGFloat)ss_right {
37 | CGRect frame = self.frame;
38 | frame.origin.x = ss_right - frame.size.width;
39 | self.frame = frame;
40 | }
41 |
42 | - (CGFloat)ss_bottom {
43 | return self.frame.origin.y + self.frame.size.height;
44 | }
45 |
46 | - (void)setSs_bottom:(CGFloat)ss_bottom {
47 | CGRect frame = self.frame;
48 | frame.origin.y = ss_bottom - frame.size.height;
49 | self.frame = frame;
50 | }
51 |
52 | - (CGFloat)ss_width {
53 | return self.frame.size.width;
54 | }
55 |
56 | - (void)setSs_width:(CGFloat)ss_width {
57 | CGRect frame = self.frame;
58 | frame.size.width = ss_width;
59 | self.frame = frame;
60 | }
61 |
62 | - (CGFloat)ss_height {
63 | return self.frame.size.height;
64 | }
65 |
66 | - (void)setSs_height:(CGFloat)ss_height {
67 | CGRect frame = self.frame;
68 | frame.size.height = ss_height;
69 | self.frame = frame;
70 | }
71 |
72 | - (CGFloat)ss_centerX {
73 | return self.center.x;
74 | }
75 |
76 | - (void)setSs_centerX:(CGFloat)ss_centerX {
77 | self.center = CGPointMake(ss_centerX, self.center.y);
78 | }
79 |
80 | - (CGFloat)ss_centerY {
81 | return self.center.y;
82 | }
83 |
84 | - (void)setSs_centerY:(CGFloat)ss_centerY {
85 | self.center = CGPointMake(self.center.x, ss_centerY);
86 | }
87 |
88 | - (CGPoint)ss_origin {
89 | return self.frame.origin;
90 | }
91 |
92 | - (void)setSs_origin:(CGPoint)ss_origin {
93 | CGRect frame = self.frame;
94 | frame.origin = ss_origin;
95 | self.frame = frame;
96 | }
97 |
98 | - (CGSize)ss_size {
99 | return self.frame.size;
100 | }
101 |
102 | - (void)setSs_size:(CGSize)ss_size {
103 | CGRect frame = self.frame;
104 | frame.size = ss_size;
105 | self.frame = frame;
106 | }
107 |
108 | @end
109 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Controllers/SSScanViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSScanViewController.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class SSScanViewController;
12 | @class SSIDCard;
13 |
14 | @protocol SSScanViewControllerDelegate
15 |
16 | @required
17 | - (void)ss_scanViewController:(SSScanViewController *)scanViewController didObtainedRecognizeResult:(SSIDCard *)idcard;
18 |
19 | @end
20 |
21 | typedef void(^recognizeBlock)(SSIDCard *idcard);
22 |
23 | @interface SSScanViewController : UIViewController
24 |
25 | @property (nonatomic, weak) id delegate;
26 |
27 | - (instancetype)initWithBlock:(recognizeBlock)recognizeBlock;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Models/SSConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSConstants.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #define SS_IDCARDHEIGTHWIDTHRATIO (54.0 / 85.6) // 身份证高与宽的比
13 | #define SS_IDWIDTH 290.0 // 身份证的宽
14 | #define SS_CAPTURESESSIONWIDTH 1080.0 // session的宽
15 | #define SS_CAPTURESESSIONHEIGHT 1920.0 // session的高
16 |
17 | #define SS_IS_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? [[UIScreen mainScreen] currentMode].size.height == 2436 : NO)
18 |
19 | @interface SSConstants : NSObject
20 |
21 | CGFloat ss_viewWidth(void);
22 | CGFloat ss_viewHeight(void);
23 | CGFloat ss_viewRatio320(void);
24 | CGFloat ss_viewRatio375(void);
25 | CGFloat ss_statusBarHeight(void);
26 | CGFloat ss_navigationBarHeight(void);
27 | CGFloat ss_navigationBottom(void);
28 | CGFloat ss_iphoneXBottom(void);
29 | BOOL ss_isiPhoneX(void);
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Models/SSConstants.m:
--------------------------------------------------------------------------------
1 | //
2 | // SSConstants.m
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import "SSConstants.h"
10 |
11 | @implementation SSConstants
12 |
13 | CGFloat ss_viewWidth() {
14 | static CGFloat viewWidth = 0;
15 | if (viewWidth == 0) {
16 | viewWidth = [UIScreen mainScreen].bounds.size.width;
17 | }
18 |
19 | return viewWidth;
20 | }
21 |
22 | CGFloat ss_viewHeight() {
23 | static CGFloat viewHeight = 0;
24 | if (viewHeight == 0) {
25 | viewHeight = [UIScreen mainScreen].bounds.size.height;
26 | }
27 |
28 | return viewHeight;
29 | }
30 |
31 | CGFloat ss_viewRatio320(){
32 | static CGFloat viewRatio320 = 0;
33 | if (viewRatio320 == 0){
34 | viewRatio320 = ss_viewWidth() / 320;
35 | }
36 | return viewRatio320;
37 | }
38 |
39 | CGFloat ss_viewRatio375(){
40 | static CGFloat viewRatio375 = 0;
41 | if (viewRatio375 == 0){
42 | viewRatio375 = ss_viewWidth() / 375;
43 | }
44 | return viewRatio375;
45 | }
46 |
47 | CGFloat ss_statusBarHeight() {
48 | static CGFloat statusBarHeight = 0.0;
49 | if (statusBarHeight == 0.0) {
50 | statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
51 | }
52 | return statusBarHeight;
53 | }
54 |
55 | CGFloat ss_navigationBarHeight() {
56 | static CGFloat navigationBarHeight = 0.0;
57 | if (navigationBarHeight == 0.0) {
58 | navigationBarHeight = 44.0;
59 | }
60 | return navigationBarHeight;
61 | }
62 |
63 | CGFloat ss_navigationBottom() {
64 | return ss_statusBarHeight() + ss_navigationBarHeight();
65 | }
66 |
67 | CGFloat ss_iphoneXBottom() {
68 | return SS_IS_iPhoneX ? 34.0 : 0.0;
69 | }
70 |
71 | BOOL ss_isiPhoneX() {
72 | return SS_IS_iPhoneX;
73 | }
74 |
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/SSIDCard.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSIDCard.h
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/4/27.
6 | //
7 |
8 | #import
9 | #import "SSScanViewController.h"
10 |
11 | @interface SSIDCard : NSObject
12 | /** 姓名 */
13 | @property (nonatomic, copy) NSString *idName;
14 | /** ID */
15 | @property (nonatomic, copy) NSString *idNumber;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/SSIDCard.m:
--------------------------------------------------------------------------------
1 | //
2 | // SSIDCard.m
3 | // SSIDCard
4 | //
5 | // Created by 张家铭 on 2018/4/27.
6 | //
7 |
8 | #import "SSIDCard.h"
9 |
10 | @implementation SSIDCard
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Tools/SSImageTool.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSImageTool.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface SSImageTool : NSObject
14 |
15 | /**
16 | * 将CMSampleBufferRef转成UIImage对象
17 |
18 | * @param sampleBuffer sampleBuffer
19 | * @return image
20 | */
21 | + (UIImage *)ss_imageWithSampleBuffer:(CMSampleBufferRef)sampleBuffer;
22 |
23 | /**
24 | * 根据rect裁剪图片
25 |
26 | * @param image image
27 | * @param rect rect
28 | * @return image
29 | */
30 | + (UIImage *)ss_imageWithImage:(UIImage *)image inRect:(CGRect)rect;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Tools/SSImageTool.m:
--------------------------------------------------------------------------------
1 | //
2 | // SSImageTool.m
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import "SSImageTool.h"
10 |
11 | @implementation SSImageTool
12 |
13 | + (UIImage *)ss_imageWithSampleBuffer:(CMSampleBufferRef)sampleBuffer {
14 | CVImageBufferRef buffer;
15 | buffer = CMSampleBufferGetImageBuffer(sampleBuffer);
16 |
17 | CVPixelBufferLockBaseAddress(buffer, 0);
18 |
19 | uint8_t *base;
20 | size_t width, height, bytesPerRow;
21 | base = CVPixelBufferGetBaseAddress(buffer);
22 | width = CVPixelBufferGetWidth(buffer);
23 | height = CVPixelBufferGetHeight(buffer);
24 | bytesPerRow = CVPixelBufferGetBytesPerRow(buffer);
25 |
26 | CGColorSpaceRef colorSpace;
27 | CGContextRef cgContext;
28 | colorSpace = CGColorSpaceCreateDeviceRGB();
29 | cgContext = CGBitmapContextCreate(base, width, height, 8, bytesPerRow, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
30 | CGColorSpaceRelease(colorSpace);
31 |
32 | CGImageRef cgImage;
33 | UIImage *image;
34 | cgImage = CGBitmapContextCreateImage(cgContext);
35 | image = [UIImage imageWithCGImage:cgImage];
36 | CGImageRelease(cgImage);
37 | CGContextRelease(cgContext);
38 |
39 | CVPixelBufferUnlockBaseAddress(buffer, 0);
40 |
41 | return image;
42 | }
43 |
44 | + (UIImage *)ss_imageWithImage:(UIImage *)image inRect:(CGRect)rect {
45 | if (rect.size.width >= image.size.width
46 | && rect.size.height >= image.size.height) {
47 | return image;
48 | }
49 |
50 | CGImageRef newImageRef = CGImageCreateWithImageInRect(image.CGImage, rect);
51 | UIImage *returnImage = [UIImage imageWithCGImage:newImageRef];
52 | CGImageRelease(newImageRef);
53 | return returnImage;
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Tools/SSOpencvImageTool.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSOpencvImageTool.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | @interface SSOpencvImageTool : NSObject
10 |
11 | @property (nonatomic, strong) UIImage *idNumberRectImage;
12 | @property (nonatomic, strong) UIImage *idNameRectImage;
13 |
14 | - (void)ss_processImage:(UIImage *)image;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Tools/SSTesseract.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSTesseract.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface SSTesseract : NSObject
13 |
14 | @property (nonatomic, strong) UIImage *image;
15 |
16 | @property (nonatomic, readonly) NSString *recognizedText;
17 |
18 | - (instancetype)initWithLanguage:(NSString*)language;
19 |
20 | - (BOOL)recognize;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/SSIDCard/Classes/Public/Views/SSIDCardRectView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SSIDCardRectView.h
3 | // SSIDCard_Example
4 | //
5 | // Created by 张家铭 on 2018/4/26.
6 | // Copyright © 2018年 sansansisi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SSIDCardRectView : UIView
12 |
13 | - (void)stopScanning;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/SSIDCard/Lib/liblept.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Lib/liblept.a
--------------------------------------------------------------------------------
/SSIDCard/Lib/libtesseract_all.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Lib/libtesseract_all.a
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 17E199
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleIdentifier
10 | com.zjm.SSIDCard
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | SSIDCard
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSupportedPlatforms
20 |
21 | MacOSX
22 |
23 | CFBundleVersion
24 | 1
25 | DTCompiler
26 | com.apple.compilers.llvm.clang.1_0
27 | DTPlatformBuild
28 | 9E145
29 | DTPlatformVersion
30 | GM
31 | DTSDKBuild
32 | 17E189
33 | DTSDKName
34 | macosx10.13
35 | DTXcode
36 | 0930
37 | DTXcodeBuild
38 | 9E145
39 | NSHumanReadableCopyright
40 | Copyright © 2018年 张家铭. All rights reserved.
41 |
42 |
43 |
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_navi_orange.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_navi_orange.tiff
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_profile.png
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_rect.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_rect.tiff
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_torch.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/Resources/ssidcard_torch.tiff
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeDirectory:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeDirectory
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeRequirements:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeRequirements
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeRequirements-1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeRequirements-1
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeSignature:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/Contents/_CodeSignature/CodeSignature
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/tessdata/SSIDCardName.traineddata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/tessdata/SSIDCardName.traineddata
--------------------------------------------------------------------------------
/SSIDCard/Resource/SSIDCard.bundle/tessdata/SSIDCardNumber.traineddata:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sansansisi/SSIDCard/359345c0989f345f13e70355ea6a0391c9afbd95/SSIDCard/Resource/SSIDCard.bundle/tessdata/SSIDCardNumber.traineddata
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------