diff --git a/plugins/ocr/executablepathdialogue.cpp b/plugins/ocr/executablepathdialogue.cpp index a602081..4c7aaca 100644 --- a/plugins/ocr/executablepathdialogue.cpp +++ b/plugins/ocr/executablepathdialogue.cpp @@ -1,89 +1,90 @@ /************************************************************************ * * * This file is part of Kooka, a scanning/OCR application using * * Qt and KDE Frameworks . * * * * Copyright (C) 2018 Jonathan Marten * * * * Kooka is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as * * published by the Free Software Foundation and appearing in the * * file COPYING included in the packaging of this file; either * * version 2 of the License, or (at your option) any later version. * * * * As a special exception, permission is given to link this program * * with any version of the KADMOS OCR/ICR engine (a product of * * reRecognition GmbH, Kreuzlingen), and distribute the resulting * * executable without including the source code for KADMOS in the * * source distribution. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public * * License along with this program; see the file COPYING. If * * not, see . * * * ************************************************************************/ #include "executablepathdialogue.h" #include #include #include #include ExecutablePathDialogue::ExecutablePathDialogue(QWidget *pnt) : DialogBase(pnt) { setObjectName("ExecutablePathDialogue"); setButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); + setWindowTitle(i18n("Executable Path")); QWidget *page = new QWidget(this); setMainWidget(page); QVBoxLayout *lay = new QVBoxLayout(page); mLabel = new QLabel(i18n("Executable path:"), this); lay->addWidget(mLabel); mPathRequester = new KUrlRequester(QUrl("file:///usr/bin/"), this); mPathRequester->setPlaceholderText(i18n("Enter or select the path...")); mPathRequester->setAcceptMode(QFileDialog::AcceptOpen); mPathRequester->setMimeTypeFilters(QStringList() << "application/x-executable"); mPathRequester->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly); mPathRequester->setStartDir(QUrl("file:///usr/bin/")); connect(mPathRequester, &KUrlRequester::textChanged, this, &ExecutablePathDialogue::slotTextChanged); lay->addWidget(mPathRequester); mLabel->setBuddy(mPathRequester); lay->addStretch(); } void ExecutablePathDialogue::setPath(const QString &exec) { mPathRequester->setUrl(QUrl::fromLocalFile(exec)); } void ExecutablePathDialogue::setLabel(const QString &text) { mLabel->setText(text); } QString ExecutablePathDialogue::path() const { return (mPathRequester->url().path()); } void ExecutablePathDialogue::slotTextChanged(const QString &text) { setButtonEnabled(QDialogButtonBox::Ok, !text.isEmpty()); } diff --git a/plugins/ocr/ocrad/kookaocr-ocrad.desktop b/plugins/ocr/ocrad/kookaocr-ocrad.desktop index 4d9dc40..5d9fdb8 100644 --- a/plugins/ocr/ocrad/kookaocr-ocrad.desktop +++ b/plugins/ocr/ocrad/kookaocr-ocrad.desktop @@ -1,40 +1,40 @@ [Desktop Entry] Type=Service X-KDE-ServiceTypes=Kooka/OcrPlugin X-KDE-Library=kookaocrocrad X-KDE-PluginInfo-Name=ocrad X-KDE-PluginInfo-License=GPL Icon=ocrad Name=OCRAD Name[ca]=OCRAD Name[ca@valencia]=OCRAD Name[es]=OCRAD Name[fi]=OCRAD Name[fr]=OCRAD Name[gl]=OCRAD Name[it]=OCRAD Name[ko]=OCRAD Name[nl]=OCRAD Name[pl]=OCRAD Name[pt]=OCRAD Name[sv]=OCRAD Name[uk]=OCRAD Name[x-test]=xxOCRADxx Name[zh_CN]=OCRAD Name[zh_TW]=OCRAD -Comment=OCRAD is an free software OCR engine by Antonio Diaz, part of the GNU Project.Images for OCR should be scanned in black/white (lineart) mode. Best results are achieved if the characters are at least 20 pixels high. Problems may arise, as usual, with very bold or very light or broken characters, or with merged character groups.See www.gnu.org/software/ocrad/ocrad.html for more information on OCRAD. +Comment=OCRAD is a free software OCR engine by Antonio Diaz, part of the GNU Project.Images for OCR should be scanned in black/white (lineart) mode. Best results are achieved if the characters are at least 20 pixels high. Problems may arise, as usual, with very bold or very light or broken characters, or with merged character groups.See www.gnu.org/software/ocrad/ocrad.html for more information on OCRAD. Comment[ca]=L'OCRAD és un motor d'OCR de programari lliure fet per l'Antonio Diaz, part del Projecte GNU. Les imatges per a l'OCR s'han d'escanejar en mode blanc i negre (art lineal). S'aconsegueixen els millors resultats si els caràcters tenen com a mínim 20 píxels d'alçada. Poden produir-se problemes, normalment, amb caràcters molt grossos o molt fins o trencats, o amb grups de caràcters barrejats.Vegeu www.gnu.org/software/ocrad/ocrad.html per a més informació quant a l'OCRAD. Comment[ca@valencia]=L'OCRAD és un motor d'OCR de programari lliure fet per l'Antonio Diaz, part del Projecte GNU. Les imatges per a l'OCR s'han d'escanejar en mode blanc i negre (art lineal). S'aconsegueixen els millors resultats si els caràcters tenen com a mínim 20 píxels d'alçària. Poden produir-se problemes, normalment, amb caràcters molt grossos o molt fins o trencats, o amb grups de caràcters barrejats.Vegeu www.gnu.org/software/ocrad/ocrad.html per a més informació quant a l'OCRAD. Comment[es]=OCRAD es un motor OCR de software libre creado por Antonio Díaz, que es parte del Proyecto GNU.Las imágenes para OCR se deben escanear en modo de blanco y negro (arte de línea). Los mejores resultados se consiguen cuando los caracteres tienen al menos 20 píxeles de altura. Como es natural, pueden surgir problemas con caracteres muy anchos, muy claros o incompletos, o con grupos de caracteres fusionados.Consulte www.gnu.org/software/ocrad/ocrad.html para más información sobre OCRAD. Comment[fi]=OCRAD on Antonio Diazin vapaan ohjelmiston tekstintunnistusmoottori, joka on osa GNU-projektia.Tekstintunnistuskuvat tulisi lukea mustavalkotilassa (viivapiirroksina). Parhaat tulokset saa, kun kirjaimet ovat vähintään 20 kuvapistettä korkeita. Kuten tavallista, ongelmia saattaa tulla hyvin paksuista, ohuista tai rikkonaisista kirjaimista tai yhteen sulautuneista kirjainryhmistä.Lisätietoa OCRADista löytyy sivulta www.gnu.org/software/ocrad/ocrad.html. Comment[fr]=OCRAD est un logiciel gratuit avec moteur ROC par Antonio Diaz, il fait partie du Projet GNU. Les images pour ROC doivent être scannées en mode noir et blanc (lineart). De meilleurs résultats sont obtenus si la taille des caractères est d'au moins 20 pixels. Des problèmes peuvent cependant survenir avec des polices trop épaisses, trop fines, avec des caractères entrecoupés ou fusionnés. Consultez www.gnu.org/software/ocrad/ocrad.html pour de plus amples informations sur OCRAD. Comment[gl]=OCRAD é un motor libre de recoñecemento óptico de caracteres (OCR) obra de Antonio Diaz e parte do Proxecto GNU. As imaxes para o recoñecemento óptico de caracteres deberían dixitalizarse usando o modo en branco e negro (arte de liñas). Os mellores resultados obtéñense se a altura dos caracteres é polo menos 20 píxeles. Pode haber problemas, como sempre, no caso de caracteres moi escuros, moi claros, rotos ou con grupos de caracteres mesturados. Consulte www.gnu.org/software/ocrad/ocrad.html para obter máis información sobre OCRAD. Comment[it]=OCRAD è un motore OCR libero creato da Antonio Diaz, parte del Progetto GNU.Le immagini per l'OCR devono essere scansionate in modalità bianco/nero (lineart). Si ottengono i migliori risultati se i caratteri sono alti almeno 20 pixel. Possono sorgere problemi, in genere, con caratteri molto spessi o molto sottili o incompleti, o con gruppi di caratteri mischiati.Visita il sito www.gnu.org/software/ocrad/ocrad.html per maggiori informazioni su OCRAD. Comment[ko]=OCRAD는 GNU 프로젝트의 일부인 Antonio Diaz의 자유 소프트웨어 OCR 엔진입니다.OCR용 영상은 흑백(라인아트) 모드로 스캔해야 합니다. 문자가 최소 20픽셀 이상일 경우 최상의 결과를 얻을 수 있습니다. 일반적으로 너무 굵거나, 너무 밝거나, 끊어진 문자 또는 병합된 문자 그룹에 문제가 발생할 수 있습니다.OCRAD에 대한 자세한 정보는 www.gnu.org/software/ocrad/ocrad.html 페이지를 참조하십시오. Comment[nl]=OCRAD is een vrije software OCR engine door Antonio Diaz, onderdeel van het GNU Project.Afbeeldingen voor OCR zouden gescand moeten zijn in zwart/wit (lineart) modus. De beste resultaten worden bereikt als de tekens minstens 20 pixels hoog zijn. Problemen volgen, zoals gewoonlijk, met erg vette of erg lichte of gebroken tekens of met gemengde tekengroepen.Zie www.gnu.org/software/ocrad/ocrad.html voor meer informatie over OCRAD. Comment[pl]=OCRAD jest darmowym programowym silnikiem OCR napisanym przez Antonio Diaz, jako część projektu GNU . Obrazy dla OCR powinny być skanowane w trybie czarno białym (rysunek kreskowy). Najlepsze wyniki są osiągane wtedy, gdy tekst jest wysoki na co najmniej 20 pikseli. Problemy mogą pojawić się, jak zwykle, z bardzo pogrubionym lub bardzo cienkim lub z uszkodzonymi znakami, lub ze scalonymi grupami znaków.Zobacz www.gnu.org/software/ocrad/ocrad.html po więcej informacji o OCRAD. Comment[pt]=O OCRAD é um motor de OCR em 'software' livre de Antonio Diaz, fazendo parte do Projecto GNU.As imagens do OCR devem ser digitalizadas no modo a preto/branco (linear). É possível atingir resultados melhores se os caracteres tiverem pelo menos 20 pixels de altura. Poderão surgir problemas, como é normal, com caracteres muito carregados, muito claros ou quebrados, ou ainda com grupos de caracteres reunidos.Veja em www.gnu.org/software/ocrad/ocrad.html mais informações sobre o OCRAD. Comment[sv]=OCRAD är ett fritt program för optisk teckentydning av Antonio Diaz, som ingår i GNU-projektet.Bilder för optisk teckentydning bör läsas in i svartvitt läge (streckbildsläge). De bästa resultaten uppnås om tecknen är minst 20 bildpunkter höga. Problem kan som vanligt uppstå med extrem fetstil, väldigt tunna eller brutna tecken, eller med sammanfogade teckengrupper.Se www.gnu.org/software/ocrad/ocrad.html för mer information om OCRAD. Comment[uk]=OCRAD — вільне програмне забезпечення для розпізнавання текстів, створене Antonio Diaz, є частиною проекту GNU.Зображення для розпізнавання має бути скановано у чорно-білому (штриховому) режимі. Найкращих результатів можна досягти, якщо висота символів перевищує 20 пікселів. Як завжди, проблеми можуть бути з дуже темними та дуже світлими зображеннями, пошкодженими символами або з групами символів, що перекриваються.Докладніше про OCRAD можна дізнатися тут. -Comment[x-test]=xxOCRAD is an free software OCR engine by Antonio Diaz, part of the GNU Project.Images for OCR should be scanned in black/white (lineart) mode. Best results are achieved if the characters are at least 20 pixels high. Problems may arise, as usual, with very bold or very light or broken characters, or with merged character groups.See www.gnu.org/software/ocrad/ocrad.html for more information on OCRAD.xx +Comment[x-test]=xxOCRAD is a free software OCR engine by Antonio Diaz, part of the GNU Project.Images for OCR should be scanned in black/white (lineart) mode. Best results are achieved if the characters are at least 20 pixels high. Problems may arise, as usual, with very bold or very light or broken characters, or with merged character groups.See www.gnu.org/software/ocrad/ocrad.html for more information on OCRAD.xx Comment[zh_TW]=OCRAD 是個自由的 OCR 引擎,由 Antonio Diaz 製作,為 GNU 專案中的一員。用來 OCR 的影像必須以黑白 (lineart) 模式掃描。當字符至少有 20 個像素高的狀況下可以取得最佳結果。跟平常一樣,若字符過重、過輕、不完整或者是使用合在一起的字符組合,則可能會導致解析問題。閱讀 www.gnu.org/software/ocrad/ocrad.html 取得關於 OCRAD 的更多資訊。 diff --git a/plugins/ocr/ocrad/ocrocradengine.cpp b/plugins/ocr/ocrad/ocrocradengine.cpp index d1d20e1..77a2194 100644 --- a/plugins/ocr/ocrad/ocrocradengine.cpp +++ b/plugins/ocr/ocrad/ocrocradengine.cpp @@ -1,438 +1,438 @@ /************************************************************************ * * * This file is part of Kooka, a scanning/OCR application using * * Qt and KDE Frameworks . * * * * Copyright (C) 2000-2016 Klaas Freitag * * Jonathan Marten * * * * Kooka is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as * * published by the Free Software Foundation and appearing in the * * file COPYING included in the packaging of this file; either * * version 2 of the License, or (at your option) any later version. * * * * As a special exception, permission is given to link this program * * with any version of the KADMOS OCR/ICR engine (a product of * * reRecognition GmbH, Kreuzlingen), and distribute the resulting * * executable without including the source code for KADMOS in the * * source distribution. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public * * License along with this program; see the file COPYING. If * * not, see . * * * ************************************************************************/ #include "ocrocradengine.h" #include #include #include #include #include #include #include #include #include #include "imageformat.h" #include "kookasettings.h" #include "ocrocraddialog.h" #include "executablepathdialogue.h" K_PLUGIN_FACTORY_WITH_JSON(OcrOcradEngineFactory, "kookaocr-ocrad.json", registerPlugin();) #include "ocrocradengine.moc" static const char UndetectedChar = '_'; OcrOcradEngine::OcrOcradEngine(QObject *pnt, const QVariantList &args) : AbstractOcrEngine(pnt, "OcrOcradEngine") { m_ocrImagePBM = QString::null; m_tempOrfName = QString::null; ocradVersion = 0; } AbstractOcrDialogue *OcrOcradEngine::createOcrDialogue(AbstractOcrEngine *plugin, QWidget *pnt) { return (new OcrOcradDialog(plugin, pnt)); } bool OcrOcradEngine::createOcrProcess(AbstractOcrDialogue *dia, const KookaImage *img) { OcrOcradDialog *parentDialog = static_cast(dia); ocradVersion = parentDialog->getNumVersion(); const QString cmd = parentDialog->getOCRCmd(); const QString ocrResultFile = tempSaveImage(img, ImageFormat("BMP"), 8); setResultImage(ocrResultFile); // TODO: if the input file is local and is readable by OCRAD, // can use it directly (but don't delete it afterwards!) m_ocrImagePBM = tempSaveImage(img, ImageFormat("PBM"), 1); QProcess *proc = initOcrProcess(); // start process for OCR QStringList args; // arguments for process m_tempOrfName = tempFileName("orf"); args << "-x" << m_tempOrfName; // the ORF result file args << QFile::encodeName(m_ocrImagePBM); // name of the input image // Layout Detection int layoutMode = KookaSettings::ocrOcradLayoutDetection(); if (ocradVersion >= 18) // OCRAD 0.18 or later { // has only on/off if (layoutMode != 0) args << "-l"; } else // OCRAD 0.17 or earlier { // had 3 options args << "-l" << QString::number(layoutMode); } QString s = KookaSettings::ocrOcradFormat(); if (!s.isEmpty()) args << "-F" << s; s = KookaSettings::ocrOcradCharset(); if (!s.isEmpty()) args << "-c" << s; s = KookaSettings::ocrOcradFilter(); if (!s.isEmpty()) args << "-e" << s; s = KookaSettings::ocrOcradTransform(); if (!s.isEmpty()) args << "-t" << s; if (KookaSettings::ocrOcradInvert()) args << "-i"; if (KookaSettings::ocrOcradThresholdEnable()) { s = KookaSettings::ocrOcradThresholdValue(); if (!s.isEmpty()) args << "-T" << (s + "%"); } if (verboseDebug()) args << "-v"; s = KookaSettings::ocrOcradExtraArguments(); if (!s.isEmpty()) args << s; proc->setProgram(cmd); proc->setArguments(args); proc->setProcessChannelMode(QProcess::SeparateChannels); m_tempStdoutLog = tempFileName("stdout.log"); proc->setStandardOutputFile(m_tempStdoutLog); return (runOcrProcess()); } QStringList OcrOcradEngine::tempFiles(bool retain) { QStringList result; result << m_ocrImagePBM; result << m_tempOrfName; result << m_tempStdoutLog; return (result); } bool OcrOcradEngine::finishedOcrProcess(QProcess *proc) { qDebug(); QString errStr = readORF(m_tempOrfName); // parse the OCR results if (errStr.isEmpty()) return (true); // parsed successfulyl setErrorText(errStr); // record the parse error return (false); // parsing failed } /* From http://kooka.kde.org/news/ ORF Proposal: Ocr Result File August 20, 2003 Ocrad is the first OCR (Optical Character Recognition) application that implements output of OCR results in a special file format that could be easily processed by frontend programs. To provide a proper frontend connection, ocrad implements the export of the OCR results into a so called ORF, which simply means Ocr Result File. The ORF Format is a special file format that contains OCR results like the detected characters and their position on the source image in a simply parseable format. Frontend programs can read the file and retrieve information about the OCR engine run and show up the results visually. All lines starting with '#' are ignored. The first valid line has the form 'source file filename', where 'filename' is the name of the PBM file being processed. The second valid line has the form 'total blocks n', where 'n' is the total number of text blocks in the source image. For each text block in the source image, the following data follows: A line in the form 'block i x y w h', where 'i' is the block number and 'x y w h' are the block position and size as described below for character boxes. A line in the form 'lines n', where 'n' is the number of lines in this block. For each line in every text block, the following data follows: A line in the form 'line i chars n height h', where 'i' is the line number, 'n' is the number of characters in this line, and 'h' is the mean height of the characters in this line (in pixels). n lines (one for every character) in the form "x y w h b;g[,'c'v]...". 'x' = the left border (x-coordinate) of the char bounding box in the source image (in pixels). 'y' = the top border (y-coordinate). 'w' = the width of the bounding box. 'h' = the height of the bounding box. 'b' = the percent of black pixels in the bounding box. 'g' = the number of different recognition guesses for this character. The result characters follow after the number of guesses in the form of a comma-separated list of pairs. Every pair is formed by the actual recognised char enclosed in single quotes, followed by the confidence value without space between them. See the following snippet (the beginning of an orf) as a sample ORF: # Ocr Results File. Created by GNU ocrad version 0.4 source file test1.pbm total blocks 1 block 1 0 0 560 792 lines 12 line 1 chars 10 height 26 71 109 17 26;2,'0'1,'o'0 93 109 15 26;2,'1'1,'l'0 110 109 18 26;1,'2'0 131 109 18 26;1,'3'0 151 109 19 26;1,'4'0 172 109 17 26;1,'5'0 193 109 17 26;1,'6'0 213 108 17 27;1,'7'0 232 109 18 26;1,'8'0 253 109 17 26;1,'9'0 line 2 chars 14 height 27 68 153 29 27;1,'A'0 97 153 24 27;1,'B'0 ... The ORF format was defined by Antonio Diaz and Klaas Freitag. Comments are very welcome. */ QString OcrOcradEngine::readORF(const QString &fileName) { QFile file(fileName); // some checks on the ORF if (!file.exists()) { return (xi18nc("@info", "File %1 does not exist", fileName)); } QFileInfo fi(fileName); if (!fi.isReadable()) { return (xi18nc("@info", "File %1 unreadable", fileName)); } if (!file.open(QIODevice::ReadOnly)) { return (xi18nc("@info", "Cannot open file %1", fileName)); } QTextStream stream(&file); qDebug() << "Starting to analyse ORF" << fileName << "version" << ocradVersion; // to match "block 1 0 0 560 792" const QRegExp rx1("^.*block\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)"); // to match "line 5 chars 13 height 20" const QRegExp rx2("^line\\s+(\\d+)\\s+chars\\s+(\\d+)\\s+height\\s+\\d+"); // to match " 1, 'r'0" const QRegExp rx3("^\\s*(\\d+)"); // to match "110 109 18 26" const QRegExp rx4("(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)"); /* use a global line number counter here, not the one from the orf. The orf one * starts at 0 for every block, but we want line-no counting page global here. */ int lineNo = 0; int blockCnt = 0; QString line; QRect blockRect; startResultDocument(); while (!stream.atEnd()) { line = stream.readLine().trimmed(); // line of text excluding '\n' if (line.startsWith("#")) { continue; // ignore comments } if (verboseDebug()) { //qDebug() << "# Line" << line; } if (line.startsWith("source file ")) { continue; // source file name, ignore } else if (line.startsWith("total blocks ")) { // total count of blocks, // must be first line blockCnt = line.mid(13).toInt(); qDebug() << "Block count (V<10)" << blockCnt; } else if (line.startsWith("total text blocks ")) { blockCnt = line.mid(18).toInt(); qDebug() << "Block count (V>10)" << blockCnt; } else if (line.startsWith("block ") || line.startsWith("text block ")) { // start of text block // matching "block 1 0 0 560 792" if (rx1.indexIn(line) == -1) { //qDebug() << "Failed to match 'block' line" << line; continue; } int currBlock = (rx1.cap(1).toInt()) - 1; blockRect.setRect(rx1.cap(2).toInt(), rx1.cap(3).toInt(), rx1.cap(4).toInt(), rx1.cap(5).toInt()); //qDebug() << "Current block" << currBlock << "rect" << blockRect; } else if (line.startsWith("lines ")) { // lines in this block //qDebug() << "Block line count" << line.mid(6).toInt(); } else if (line.startsWith("line ")) { // start of text line startLine(); if (rx2.indexIn(line) == -1) { //qDebug() << "Failed to match 'line' line" << line; continue; } int charCount = rx2.cap(2).toInt(); if (verboseDebug()) { //qDebug() << "Expecting" << charCount << "chars for line" << lineNo; } QString word; QRect wordRect; for (int c = 0; c < charCount && !stream.atEnd(); ++c) { // read one line per character QString charLine = stream.readLine(); int semiPos = charLine.indexOf(';'); if (semiPos == -1) { //qDebug() << "No ';' in 'char' line" << charLine; continue; } // rectStr contains the rectangle of the character QString rectStr = charLine.left(semiPos); // resultStr contains the OCRed result character(s) QString resultStr = charLine.mid(semiPos + 1); QChar detectedChar = UndetectedChar; // find how many alternatives, matching " 1, 'r'0" if (rx3.indexIn(resultStr) == -1) { //qDebug() << "Failed to match" << resultStr << "in 'char' line" << charLine; continue; } int altCount = rx3.cap(1).toInt(); if (altCount == 0) { // no alternatives, // undecipherable character if (verboseDebug()) { //qDebug() << "Undecipherable character in 'char' line" << charLine; } } else { int h = resultStr.indexOf(','); if (h == -1) { //qDebug() << "No ',' in" << resultStr << "in 'char' line" << charLine; continue; } resultStr = resultStr.remove(0, h + 1).trimmed(); // TODO: this only uses the first alternative detectedChar = resultStr.at(1); // Analyse the result rectangle if (detectedChar != ' ') { if (rx4.indexIn(rectStr) == -1) { //qDebug() << "Failed to match" << rectStr << "in 'char' line" << charLine; continue; } QRect r(rx4.cap(1).toInt(), rx4.cap(2).toInt(), rx4.cap(3).toInt(), rx4.cap(4).toInt()); wordRect |= r; } } if (detectedChar == ' ') { // space terminates the word if (ocradVersion < 10) { // offset is relative to block wordRect.translate(blockRect.x(), blockRect.y()); } OcrWordData wd; wd.setProperty(OcrWordData::Rectangle, wordRect); addWord(word, wd); word = QString::null; // reset for next time wordRect = QRect(); } else { word.append(detectedChar); // append char to word } } // end of text line loop ++lineNo; if (!word.isEmpty()) { // last word in line if (ocradVersion < 10) { // offset is relative to block wordRect.translate(blockRect.x(), blockRect.y()); } OcrWordData wd; wd.setProperty(OcrWordData::Rectangle, wordRect); addWord(word, wd); word = QString::null; // reset for next time wordRect = QRect(); } finishLine(); } else { //qDebug() << "Unknown line format" << line; } } file.close(); // finished with ORF file finishResultDocument(); qDebug() << "Finished analysing ORF"; return (QString::null); // no error detected } void OcrOcradEngine::openAdvancedSettings() { ExecutablePathDialogue d(nullptr); QString exec = KookaSettings::ocrOcradBinary(); if (exec.isEmpty()) { KConfigSkeletonItem *ski = KookaSettings::self()->ocrOcradBinaryItem(); ski->setDefault(); exec = KookaSettings::ocrOcradBinary(); } d.setPath(exec); - d.setLabel(i18n("Name or path of the OCRAR executable:")); + d.setLabel(i18n("Name or path of the OCRAD executable:")); if (!d.exec()) return; KookaSettings::setOcrOcradBinary(d.path()); }