File indexing completed on 2024-05-12 15:55:08
0001 /************************************************************************ 0002 * * 0003 * This file is part of Kooka, a scanning/OCR application using * 0004 * Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>. * 0005 * * 0006 * Copyright (C) 2020 Jonathan Marten <jjm@keelhaul.me.uk> * 0007 * * 0008 * Kooka is free software; you can redistribute it and/or modify it * 0009 * under the terms of the GNU Library General Public License as * 0010 * published by the Free Software Foundation and appearing in the * 0011 * file COPYING included in the packaging of this file; either * 0012 * version 2 of the License, or (at your option) any later version. * 0013 * * 0014 * As a special exception, permission is given to link this program * 0015 * with any version of the KADMOS OCR/ICR engine (a product of * 0016 * reRecognition GmbH, Kreuzlingen), and distribute the resulting * 0017 * executable without including the source code for KADMOS in the * 0018 * source distribution. * 0019 * * 0020 * This program is distributed in the hope that it will be useful, * 0021 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0023 * GNU General Public License for more details. * 0024 * * 0025 * You should have received a copy of the GNU General Public * 0026 * License along with this program; see the file COPYING. If * 0027 * not, see <http://www.gnu.org/licenses/>. * 0028 * * 0029 ************************************************************************/ 0030 0031 #ifndef OCRTESSERACTENGINE_H 0032 #define OCRTESSERACTENGINE_H 0033 0034 #include "abstractocrengine.h" 0035 0036 0037 class OcrTesseractEngine : public AbstractOcrEngine 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 explicit OcrTesseractEngine(QObject *pnt, const QVariantList &args); 0043 ~OcrTesseractEngine() override = default; 0044 0045 AbstractOcrDialogue *createOcrDialogue(AbstractOcrEngine *plugin, QWidget *pnt) override; 0046 0047 bool hasAdvancedSettings() const override { return (true); } 0048 void openAdvancedSettings() override; 0049 0050 protected: 0051 bool createOcrProcess(AbstractOcrDialogue *dia, ScanImage::Ptr img) override; 0052 QStringList tempFiles(bool retain) override; 0053 bool finishedOcrProcess(QProcess *proc) override; 0054 0055 private: 0056 QString readHOCR(const QString &fileName); 0057 0058 private: 0059 QString m_ocrImageIn; 0060 QString m_tempHOCROut; 0061 QString m_tempStdoutLog; 0062 0063 int m_tesseractVersion; 0064 }; 0065 0066 #endif // OCRTESSERACTENGINE_H