Posts

Detecting page orientation (C++)

I have a bunch of images that I would like to rotate based on page orientation. So I search for possible solutions within tesseract&leptonica...

OCR screen area (with Capture2Text)

Image
If you are annoyed by the current trend of posting text like images on websites - there is a solution (based on tesseract) - Capture2Text.

python with CUDA/GPU support on Windows

Image
  Setting up Windows for Python CUDA/GPU support step by step.

Preparing Windows for Tesseract "Makefile training" (LSTM training)

Image
The Tesseract Makefile training/LSTM training from existing images was created on Linux (unix like) system using the usual Unix tools.  Fortunately, many these tools can also be installed on Windows.

Tesseract LSTM training (aka Makefile training)

  Tesseract LSTM training (aka Makefile training) on Raspberry Pi "Makefile training"  is example of training from existing data (set of image& ground truth file). This tutorial does not cover how to create and prepare training data - this step is crucial for good OCR results. Install general tools sudo apt update sudo apt install make wget bash unzip bc python3 byobu Note : byobu  (text-based window manager and terminal multiplexer) is not necessarily needed for training - but it is very useful when you start training from a remote computer. Installing the latest tesseract on Raspberry Pi If you use Debian-based OS (e.g. Raspbian), no current Tesseract version is available by default (due to Debian's strict update policy). However, you can use the notesalexp  repository (for Debian and Ubuntu) to get the latest stable version: sudo apt install apt-transport-https sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak-$(date +%Y%m%d) echo "deb https://no

Create filename with current time stamp (c++) without c++20

Code log.cpp #include <fstream> #include <iostream> #include <iomanip> #include <ctime> #include <sstream> int main() { auto t = std::time(nullptr); auto tm = *std::localtime(&t); std::stringstream transTime; transTime << std::put_time(&tm, "%Y%m%d-%H%M%S"); std::string fileName = "example-" + transTime.str() ; fileName.append(".txt"); std::cout << fileName << std::endl; std::ofstream file(fileName, std::ios::app); file << "Writing this to a file.\n"; file.close() } Build and run > clang log.cpp -o log.exe Or > "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" x64 > cl log.cpp /Fe /EHsc

Flask: Drag & Drop + Click & Select example | single page app

Image
Flask: Drag & Drop + Click & Select | example single page app I needed to create a simple web page that takes the MS Excel file as input, reads it, and shows the result.