Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/tesseract/src/training/mergenf.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /****************************************************************************** | |
| 2 ** Filename: MergeNF.c | |
| 3 ** Purpose: Program for merging similar nano-feature protos | |
| 4 ** Author: Dan Johnson | |
| 5 ** | |
| 6 ** (c) Copyright Hewlett-Packard Company, 1988. | |
| 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_TRAINING_MERGENF_H_ | |
| 19 #define TESSERACT_TRAINING_MERGENF_H_ | |
| 20 | |
| 21 /**---------------------------------------------------------------------------- | |
| 22 Include Files and Type Defines | |
| 23 ----------------------------------------------------------------------------**/ | |
| 24 #include "cluster.h" | |
| 25 #include "ocrfeatures.h" | |
| 26 #include "picofeat.h" | |
| 27 #include "protos.h" | |
| 28 | |
| 29 #define WORST_MATCH_ALLOWED (0.9) | |
| 30 #define WORST_EVIDENCE (1.0) | |
| 31 #define MAX_LENGTH_MISMATCH (2.0 * GetPicoFeatureLength()) | |
| 32 | |
| 33 #define PROTO_SUFFIX ".mf.p" | |
| 34 #define CONFIG_SUFFIX ".cl" | |
| 35 #define NO_PROTO (-1) | |
| 36 #define XPOSITION 0 | |
| 37 #define YPOSITION 1 | |
| 38 #define MFLENGTH 2 | |
| 39 #define ORIENTATION 3 | |
| 40 | |
| 41 struct FRECT { | |
| 42 float MinX, MaxX, MinY, MaxY; | |
| 43 }; | |
| 44 | |
| 45 /**---------------------------------------------------------------------------- | |
| 46 Public Macros | |
| 47 ----------------------------------------------------------------------------**/ | |
| 48 #define CenterX(M) ((M)[XPOSITION]) | |
| 49 #define CenterY(M) ((M)[YPOSITION]) | |
| 50 #define LengthOf(M) ((M)[MFLENGTH]) | |
| 51 #define OrientationOf(M) ((M)[ORIENTATION]) | |
| 52 | |
| 53 /**---------------------------------------------------------------------------- | |
| 54 Public Function Prototypes | |
| 55 ----------------------------------------------------------------------------**/ | |
| 56 float CompareProtos(tesseract::PROTO_STRUCT *p1, tesseract::PROTO_STRUCT *p2); | |
| 57 | |
| 58 void ComputeMergedProto(tesseract::PROTO_STRUCT *p1, tesseract::PROTO_STRUCT *p2, float w1, float w2, | |
| 59 tesseract::PROTO_STRUCT *MergedProto); | |
| 60 | |
| 61 int FindClosestExistingProto(tesseract::CLASS_TYPE Class, int NumMerged[], | |
| 62 tesseract::PROTOTYPE *Prototype); | |
| 63 | |
| 64 void MakeNewFromOld(tesseract::PROTO_STRUCT *New, tesseract::PROTOTYPE *Old); | |
| 65 | |
| 66 float SubfeatureEvidence(tesseract::FEATURE Feature, tesseract::PROTO_STRUCT *Proto); | |
| 67 | |
| 68 double EvidenceOf(double Similarity); | |
| 69 | |
| 70 bool DummyFastMatch(tesseract::FEATURE Feature, tesseract::PROTO_STRUCT *Proto); | |
| 71 | |
| 72 void ComputePaddedBoundingBox(tesseract::PROTO_STRUCT *Proto, float TangentPad, float OrthogonalPad, | |
| 73 FRECT *BoundingBox); | |
| 74 | |
| 75 bool PointInside(FRECT *Rectangle, float X, float Y); | |
| 76 | |
| 77 #endif // TESSERACT_TRAINING_MERGENF_H_ |
