File indexing completed on 2024-05-12 15:55:07

0001 /***************************************************************************
0002                 kocrkadmos.h - ocr dialog for KADMOS ocr engine
0003                              -------------------
0004     begin                : Sun Jun 11 2000
0005     copyright            : (C) 2000 by Klaas Freitag
0006     email                : freitag@suse.de
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *  This file may be distributed and/or modified under the terms of the    *
0012  *  GNU General Public License version 2 as published by the Free Software *
0013  *  Foundation and appearing in the file COPYING included in the           *
0014  *  packaging of this file.                                                *
0015  *
0016  *  As a special exception, permission is given to link this program       *
0017  *  with any version of the KADMOS ocr/icr engine of reRecognition GmbH,   *
0018  *  Kreuzlingen and distribute the resulting executable without            *
0019  *  including the source code for KADMOS in the source distribution.       *
0020  *
0021  *  As a special exception, permission is given to link this program       *
0022  *  with any edition of Qt, and distribute the resulting executable,       *
0023  *  without including the source code for Qt in the source distribution.   *
0024  *                                                                         *
0025  ***************************************************************************/
0026 
0027 #ifndef OCRKADMOSDIALOG_H
0028 #define OCRKADMOSDIALOG_H
0029 
0030 #include <qmap.h>
0031 
0032 #include "ocrbasedialog.h"
0033 
0034 /**
0035   *@author Klaas Freitag
0036   */
0037 
0038 class QWidget;
0039 class Q3GroupBox;
0040 class QCheckBox;
0041 class QRadioButton;
0042 class QComboBox;
0043 class Q3ButtonGroup;
0044 
0045 //class KScanCombo;
0046 
0047 class KadmosClassifier   /* Not yet used FIXME */
0048 {
0049 public:
0050     virtual KadmosClassifier(const QString &lang, const QString &filename);
0051 
0052     QString getCmplFilename() const
0053     {
0054         return path + filename;
0055     }
0056     QString getFilename()     const
0057     {
0058         return filename;
0059     }
0060     QString language()        const
0061     {
0062         return languagesName;
0063     }
0064 
0065     void setPath(const QString &p)
0066     {
0067         path = p;
0068     }
0069 
0070 private:
0071     QString filename;
0072     QString path;
0073     QString languagesName;
0074 };
0075 
0076 class KadmosDialog: public OcrBaseDialog
0077 {
0078     Q_OBJECT
0079 
0080 public:
0081     KadmosDialog(QWidget *parent);
0082     virtual ~KadmosDialog();
0083 
0084     typedef QMap<QString, QString> StrMap;
0085 
0086     OcrEngine::EngineError setupGui() override;
0087     bool getAutoScale();
0088     bool getNoiseReduction();
0089     bool getSelClassifier(QString &) const;
0090     QString getSelClassifierName() const;
0091 
0092     QString ocrEngineName() const override;
0093     QString ocrEngineDesc() const override;
0094     QString ocrEngineLogo() const override;
0095 
0096 public slots:
0097     void enableFields(bool) override;
0098 
0099 protected:
0100     void setupPreprocessing(QWidget *box);
0101     void setupSegmentation(QWidget *box);
0102     void setupClassification(QWidget *box);
0103 
0104     OcrEngine::EngineError findClassifiers();
0105     OcrEngine::EngineError findClassifierPath();
0106 
0107 protected slots:
0108     void slotWriteConfig() override;
0109 
0110 private slots:
0111     void slotFontChanged(int id);
0112 
0113 private:
0114     StrMap                m_classifierTranslate;
0115 
0116     QCheckBox             *m_cbNoise;
0117     QCheckBox             *m_cbAutoscale;
0118     QString                m_customClassifierPath;
0119 
0120     Q3ButtonGroup     *m_bbFont;
0121 
0122     QRadioButton          *m_rbMachine;
0123     QRadioButton          *m_rbHand;
0124     QRadioButton          *m_rbNorm;
0125 
0126     Q3GroupBox            *m_gbLang;
0127 
0128     QComboBox             *m_cbLang;
0129 
0130     QStringList            m_ttfClassifier;
0131     QStringList            m_handClassifier;
0132     QStringList            m_classifierPath;
0133 
0134     bool                   m_haveNorm;
0135 
0136     typedef QMap<QString, QString> StringMap;
0137     StringMap m_longCountry2short;
0138 };
0139 
0140 #endif                          // OCRKADMOSDIALOG_H