completed image ocr

This commit is contained in:
leca 2024-09-01 16:57:25 +03:00
parent 5c6700f621
commit e5435c67e3
3 changed files with 56 additions and 13 deletions

View File

@ -1,3 +1,3 @@
# checks-parser
C++/QT desktop program for parsing checks to xlsx/csv
C++/QT desktop program for parsing checks to csv

View File

@ -6,6 +6,7 @@
#include "settings.h"
#include <iostream>
#include <QFileDialog>
#include "image/checkimage.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
@ -36,20 +37,20 @@ void MainWindow::setupStoresList() {
}
void MainWindow::on_checkType_currentIndexChanged(int index) {
ui->inputHolder->setCurrentIndex(index);
// switch (index) {
// case 0:
// ui->checkInfoText->setVisible(true);
// break;
// case 1:
// ui->checkInfoText->setVisible(false);
// break;
// }
}
void MainWindow::on_parseButton_clicked() {
QString s(ui->checkContent->toPlainText());
QString s;
switch (ui->checkType->currentIndex()) {
case 0:
s = ui->checkContent->toPlainText();
break;
case 1:
s = ui->checkContentFromImage->toPlainText();
break;
}
std::wstring check_plaintext = s.toStdWString();
parser.set_module(parser.search_modules()[0]);
@ -81,6 +82,12 @@ void MainWindow::on_chooseImageButton_clicked() {
std::cout << filename.toStdString() << std::endl;
// this->options.set_path(filename.toStdString());
ui->pathLabel->setText("Path to export: " + filename);
std::string new_text = "Path to export: " + filename.toStdString();
ui->pathLabel->setText(QString::fromStdString(new_text));
CheckImage i(filename.toStdString());
std::string parsed = i.parse_text();
ui->checkContentFromImage->setPlainText(QString::fromStdString(parsed));
}

View File

@ -113,7 +113,7 @@
<rect>
<x>110</x>
<y>20</y>
<width>161</width>
<width>381</width>
<height>18</height>
</rect>
</property>
@ -134,8 +134,44 @@
<string>Choose</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>571</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Here is recognised check text. Please, edit it if something's wrong:</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="checkContentFromImage">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>471</width>
<height>371</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="parseButton">
<property name="geometry">
<rect>
<x>30</x>
<y>560</y>
<width>80</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Parse</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">