Skip to content

Commit b91a926

Browse files
committed
Extract text by image and use rapidocr feature for this.
1 parent 1f65b81 commit b91a926

15 files changed

Lines changed: 818 additions & 394 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# bigocrpdf
22
# EN
33

4-
OCR for PDF and image files integrated into the system.
4+
OCR for PDF and image files integrated into the system, now powered by RapidOCR for faster recognition and better accuracy.
55

66
PDF files that have been scanned do not have the option to search or copy the text, in BigLinux just right-click on the file and use the OCR option, a new file will be created with these resources.
77

@@ -11,8 +11,10 @@ It is also possible to extract text from an image file, just right-click and use
1111

1212
And it is still possible to use it directly from the screen capture tool, for example, if a text that you need to copy appears in the video, just press the “Print Screen” key, use the “Rectangular Region” tool, select the region with the text and then click on “Export”, and on “Extract text from image (OCR).
1313

14+
You can choose whether the queue should accept PDFs or images before starting the conversion, making it easy to switch between document and picture processing.
15+
1416
# PT
15-
OCR para PDF e arquivos de imagem integrado no sistema.
17+
OCR para PDF e arquivos de imagem integrado no sistema, agora com RapidOCR para reconhecimento mais rápido e preciso.
1618

1719
Arquivos em formato PDF que foram digitalizados não possuem a opção de efetuar buscas ou copiar o texto, no BigLinux basta clicar com o botão direito no arquivo e utilizar a opção de OCR, será criado um novo arquivo com esses recursos.
1820

@@ -22,5 +24,7 @@ Também é possível extrair o texto de um arquivo de imagem, basta clicar com o
2224

2325
E ainda é possível utilizar diretamente da ferramenta de captura de tela, por exemplo, se aparece no vídeo um texto que você precisa copiar, basta apertar a tecla “Print Screen”, utilizar a ferramenta de “Região Retangular”, selecionar a região com o texto e depois clicar em “Exportar”, e em “Extrair o texto da imagem (OCR).
2426

27+
Agora é possível escolher se a fila deve aceitar PDFs ou imagens antes de iniciar a conversão, facilitando alternar entre documentos e fotos.
28+
2529

2630
![01](https://user-images.githubusercontent.com/6098501/178167560-d00d941c-8ba7-46b9-9c64-4bd1a8a47a13.jpeg)

bigocrpdf/usr/share/biglinux/bigocrpdf/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
SAVEFILE_PATH = os.path.join(CONFIG_DIR, "savefile")
4646
SUFFIX_FILE_PATH = os.path.join(CONFIG_DIR, "suffix")
4747
SAME_FOLDER_PATH = os.path.join(CONFIG_DIR, "same-folder")
48+
INPUT_TYPE_FILE_PATH = os.path.join(CONFIG_DIR, "input-type")
4849

4950
# Ensure configuration directory exists
5051
os.makedirs(CONFIG_DIR, exist_ok=True)
@@ -100,4 +101,4 @@ def setup_environment() -> None:
100101
VERBOSE_MODE = True
101102

102103
# Create config directory if it doesn't exist
103-
os.makedirs(CONFIG_DIR, exist_ok=True)
104+
os.makedirs(CONFIG_DIR, exist_ok=True)

bigocrpdf/usr/share/biglinux/bigocrpdf/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ def check_dependencies() -> bool:
3939
from gi.repository import Gtk # noqa
4040
from gi.repository import Adw # noqa
4141

42-
# Check for OCRmyPDF - import only inside this function
43-
import ocrmypdf # noqa
42+
# Check for RapidOCR dependencies
43+
import rapidocr_onnxruntime # noqa
44+
import fitz # noqa
45+
import numpy # noqa
46+
from PIL import Image # noqa
4447

4548
return True
4649
except (ImportError, ValueError) as e:
4750
print(f"{_('Error: Missing dependencies')}: {e}")
48-
print(_("Please make sure GTK4, libadwaita, and OCRmyPDF are installed"))
51+
print(_("Please make sure GTK4, libadwaita, RapidOCR, PyMuPDF, numpy, and Pillow are installed"))
4952
return False
5053

5154

@@ -107,4 +110,4 @@ def main() -> int:
107110

108111

109112
if __name__ == "__main__":
110-
sys.exit(main())
113+
sys.exit(main())

bigocrpdf/usr/share/biglinux/bigocrpdf/services/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
77
Modules:
88
- settings: Handles application configuration and file management
9-
- processor: Main OCR processing module integrating with OCRmyPDF
10-
- ocr_api: Low-level integration with OCRmyPDF Python API
9+
- processor: Main OCR processing module integrating RapidOCR
10+
- ocr_api: Low-level integration with the RapidOCR worker queue
1111
"""
1212

1313
from .ocr_api import OcrQueue, OcrProcess, configure_logging

0 commit comments

Comments
 (0)