Commit 0922cf52 for tesseract
commit 0922cf52333df0030883891831e6bfa5db9dec26
Author: Stefan Weil <sw@weilnetz.de>
Date: Fri Jun 19 14:34:22 2026 +0200
Remove src/classify/mf.*
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/Makefile.am b/Makefile.am
index 0a3e6348..56f692c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -424,7 +424,6 @@ noinst_HEADERS += src/classify/intfx.h
noinst_HEADERS += src/classify/intmatcher.h
noinst_HEADERS += src/classify/intproto.h
noinst_HEADERS += src/classify/kdtree.h
-noinst_HEADERS += src/classify/mf.h
noinst_HEADERS += src/classify/mfdefs.h
noinst_HEADERS += src/classify/mfoutline.h
noinst_HEADERS += src/classify/mfx.h
@@ -456,7 +455,6 @@ libtesseract_la_SOURCES += src/classify/intfx.cpp
libtesseract_la_SOURCES += src/classify/intmatcher.cpp
libtesseract_la_SOURCES += src/classify/intproto.cpp
libtesseract_la_SOURCES += src/classify/kdtree.cpp
-libtesseract_la_SOURCES += src/classify/mf.cpp
libtesseract_la_SOURCES += src/classify/mfoutline.cpp
libtesseract_la_SOURCES += src/classify/mfx.cpp
libtesseract_la_SOURCES += src/classify/normfeat.cpp
diff --git a/cmake/SourceLists.cmake b/cmake/SourceLists.cmake
index 698a5196..da5982ea 100644
--- a/cmake/SourceLists.cmake
+++ b/cmake/SourceLists.cmake
@@ -158,7 +158,6 @@ set(TESSERACT_SRC_CLASSIFY
src/classify/intmatcher.cpp
src/classify/intproto.cpp
src/classify/kdtree.cpp
- src/classify/mf.cpp
src/classify/mfoutline.cpp
src/classify/mfx.cpp
src/classify/normfeat.cpp
@@ -317,7 +316,6 @@ set(TESSERACT_SRC_LEGACY
src/classify/intmatcher.cpp
src/classify/intproto.cpp
src/classify/kdtree.cpp
- src/classify/mf.cpp
src/classify/mfoutline.cpp
src/classify/mfx.cpp
src/classify/normfeat.cpp
@@ -468,7 +466,6 @@ set(TESSERACT_HDR_INTERNAL
src/classify/intmatcher.h
src/classify/intproto.h
src/classify/kdtree.h
- src/classify/mf.h
src/classify/mfdefs.h
src/classify/mfoutline.h
src/classify/mfx.h
diff --git a/src/classify/blobclass.cpp b/src/classify/blobclass.cpp
index 65ccbe98..86663b6a 100644
--- a/src/classify/blobclass.cpp
+++ b/src/classify/blobclass.cpp
@@ -19,11 +19,54 @@
#include "classify.h"
#include "featdefs.h"
-#include "mf.h"
+#include "mfdefs.h" // MicroFeatureParameter
+#include "mfx.h" // BlobMicroFeatures
#include "normfeat.h"
namespace tesseract {
+/*----------------------------------------------------------------------------
+ Private Code
+----------------------------------------------------------------------------*/
+/**
+ * Call the old micro-feature extractor and then copy
+ * the features into the new format. Then deallocate the
+ * old micro-features.
+ * @param Blob blob to extract micro-features from
+ * @param cn_denorm control parameter to feature extractor.
+ * @return Micro-features for Blob.
+ */
+static FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm) {
+ auto features = BlobMicroFeatures(Blob, cn_denorm);
+ if (features.empty()) {
+ return nullptr;
+ }
+ int n = 0;
+ for ([[maybe_unused]] auto &f: features) {
+ ++n;
+ }
+ auto FeatureSet = new FEATURE_SET_STRUCT(n);
+
+ for (auto &f : features) {
+ auto Feature = new FEATURE_STRUCT(&MicroFeatureDesc);
+ for (int i = 0; i < static_cast<int>(MicroFeatureParameter::MFCount); ++i)
+ Feature->Params[i] = f[i];
+ // Bulge features are deprecated and should not be used. Set to 0.
+ Feature->Params[static_cast<int>(MicroFeatureParameter::MFBulge1)] = 0.0f;
+ Feature->Params[static_cast<int>(MicroFeatureParameter::MFBulge2)] = 0.0f;
+
+#ifndef _WIN32
+ // Assert that feature parameters are well defined.
+ for (int i = 0; i < Feature->Type->NumParams; i++) {
+ ASSERT_HOST(!std::isnan(Feature->Params[i]));
+ }
+#endif
+
+ AddFeature(FeatureSet, Feature);
+ }
+ return FeatureSet;
+} /* ExtractMicros */
+
/*---------------------------------------------------------------------------*/
// Extracts features from the given blob and saves them in the tr_file_data_
diff --git a/src/classify/mf.cpp b/src/classify/mf.cpp
deleted file mode 100644
index d56bb111..00000000
--- a/src/classify/mf.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/******************************************************************************
- ** Filename: mf.c
- ** Purpose: Micro-feature interface to flexible feature extractor.
- ** Author: Dan Johnson
- **
- ** (c) Copyright Hewlett-Packard Company, 1988.
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- ** http://www.apache.org/licenses/LICENSE-2.0
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- ******************************************************************************/
-/*----------------------------------------------------------------------------
- Include Files and Type Defines
-----------------------------------------------------------------------------*/
-#include "mf.h"
-
-#include "featdefs.h"
-#include "mfdefs.h"
-#include "mfx.h"
-
-#include <cmath>
-
-namespace tesseract {
-
-/*----------------------------------------------------------------------------
- Private Code
-----------------------------------------------------------------------------*/
-/**
- * Call the old micro-feature extractor and then copy
- * the features into the new format. Then deallocate the
- * old micro-features.
- * @param Blob blob to extract micro-features from
- * @param cn_denorm control parameter to feature extractor.
- * @return Micro-features for Blob.
- */
-FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm) {
- auto features = BlobMicroFeatures(Blob, cn_denorm);
- if (features.empty()) {
- return nullptr;
- }
- int n = 0;
- for ([[maybe_unused]] auto &f: features) {
- ++n;
- }
- auto FeatureSet = new FEATURE_SET_STRUCT(n);
-
- for (auto &f : features) {
- auto Feature = new FEATURE_STRUCT(&MicroFeatureDesc);
- for (int i = 0; i < static_cast<int>(MicroFeatureParameter::MFCount); ++i)
- Feature->Params[i] = f[i];
- // Bulge features are deprecated and should not be used. Set to 0.
- Feature->Params[static_cast<int>(MicroFeatureParameter::MFBulge1)] = 0.0f;
- Feature->Params[static_cast<int>(MicroFeatureParameter::MFBulge2)] = 0.0f;
-
-#ifndef _WIN32
- // Assert that feature parameters are well defined.
- for (int i = 0; i < Feature->Type->NumParams; i++) {
- ASSERT_HOST(!std::isnan(Feature->Params[i]));
- }
-#endif
-
- AddFeature(FeatureSet, Feature);
- }
- return FeatureSet;
-} /* ExtractMicros */
-
-} // namespace tesseract
diff --git a/src/classify/mf.h b/src/classify/mf.h
deleted file mode 100644
index b5a2fd82..00000000
--- a/src/classify/mf.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/******************************************************************************
- ** Filename: mf.h
- ** Purpose: Micro-feature interface to flexible feature extractor.
- ** Author: Dan Johnson
- **
- ** (c) Copyright Hewlett-Packard Company, 1988.
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- ** http://www.apache.org/licenses/LICENSE-2.0
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- ******************************************************************************/
-
-#ifndef MF_H
-#define MF_H
-
-#include "blobs.h"
-#include "ocrfeatures.h"
-
-namespace tesseract {
-
-FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm);
-
-} // namespace tesseract
-
-#endif
diff --git a/src/classify/trainingsample.h b/src/classify/trainingsample.h
index 12cb0fa8..eaddd2f9 100644
--- a/src/classify/trainingsample.h
+++ b/src/classify/trainingsample.h
@@ -21,7 +21,6 @@
#include "intfx.h"
#include "intmatcher.h"
#include "matrix.h"
-#include "mf.h"
#include "mfdefs.h"
#include "picofeat.h"
#include "shapetable.h"
diff --git a/src/training/common/commontraining.cpp b/src/training/common/commontraining.cpp
index 9303266b..759605ae 100644
--- a/src/training/common/commontraining.cpp
+++ b/src/training/common/commontraining.cpp
@@ -72,7 +72,6 @@ void ParseArguments(int *argc, char ***argv) {
# include "fontinfo.h"
# include "intfeaturespace.h"
# include "mastertrainer.h"
-# include "mf.h"
# include "oldlist.h"
# include "params.h"
# include "shapetable.h"
diff --git a/src/training/mftraining.cpp b/src/training/mftraining.cpp
index 48dd6cdc..c274d0af 100644
--- a/src/training/mftraining.cpp
+++ b/src/training/mftraining.cpp
@@ -40,7 +40,6 @@
#include "intproto.h"
#include "mastertrainer.h"
#include "mergenf.h"
-#include "mf.h"
#include "ocrfeatures.h"
#include "oldlist.h"
#include "protos.h"