All Projects → galfar → deskew

galfar / deskew

Licence: MPL-2.0 license
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to deskew

TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (-83.46%)
Mutual labels:  lazarus, object-pascal, free-pascal
pascal-bindings-for-c
How to use libraries created in C with Pascal
Stars: ✭ 24 (-81.1%)
Mutual labels:  object-pascal, free-pascal
Fairtris
Clone of the official classic Tetris® game for the NES console, intended for Windows and Linux systems. It implements the original mechanics and includes many regional versions and several RNGs (all in one executable).
Stars: ✭ 30 (-76.38%)
Mutual labels:  lazarus, free-pascal
AutoScreenshot
Automatic screenshot maker for Windows
Stars: ✭ 49 (-61.42%)
Mutual labels:  lazarus, free-pascal
DfmExtractor
Small command line utility which allows you to extract DFM, LFM and FRM forms from executable files compiled by Delphi, Lazarus and CodeTyphon.
Stars: ✭ 22 (-82.68%)
Mutual labels:  lazarus, free-pascal
xavier
Xavier is a small object-oriented XML library for Lazarus and Delphi
Stars: ✭ 38 (-70.08%)
Mutual labels:  lazarus, object-pascal
troll-hunter
Trollhunter is a single-player roguelike game.
Stars: ✭ 28 (-77.95%)
Mutual labels:  lazarus, free-pascal
setup-lazarus
Set up your GitHub Actions workflow with a specific version of Lazarus
Stars: ✭ 29 (-77.17%)
Mutual labels:  lazarus, free-pascal
fano
Pascal web application framework
Stars: ✭ 90 (-29.13%)
Mutual labels:  object-pascal, free-pascal
Graphics32
Graphics32 is a graphics library for Delphi and Lazarus. Optimized for 32-bit pixel formats, it provides fast operations with pixels and graphic primitives. In most cases Graphics32 considerably outperforms the standard TBitmap/TCanvas methods.
Stars: ✭ 238 (+87.4%)
Mutual labels:  lazarus
scantailor-universal
ScanTailor Universal - a fork based on Enhanced+Featured+Master versions of ST
Stars: ✭ 135 (+6.3%)
Mutual labels:  scanning
Restrequest4delphi
API to consume REST services written in any programming language with support to Lazarus and Delphi
Stars: ✭ 162 (+27.56%)
Mutual labels:  lazarus
Lazpaint
🎨 Cross-platform image editor with raster and vector layers similar to Paint.Net written in Lazarus (Free Pascal)
Stars: ✭ 236 (+85.83%)
Mutual labels:  lazarus
bcrypt
BCrypt is a password hashing function
Stars: ✭ 138 (+8.66%)
Mutual labels:  lazarus
Dataset Serialize
JSON to DataSet and DataSet to JSON converter for Delphi and Lazarus (FPC)
Stars: ✭ 213 (+67.72%)
Mutual labels:  lazarus
Bauglir-WebSocket-2
Copy of https://code.google.com/archive/p/bauglir-websocket/
Stars: ✭ 15 (-88.19%)
Mutual labels:  lazarus
Godll
how to create windows golang DLL and load into C, or delphi, or freepascal
Stars: ✭ 113 (-11.02%)
Mutual labels:  lazarus
Bgrabitmap
📜 BGRABitmap graphics library made with Lazarus (Free Pascal).
Stars: ✭ 112 (-11.81%)
Mutual labels:  lazarus
NetCom7
The fastest communications possible. Delphi rulez.
Stars: ✭ 150 (+18.11%)
Mutual labels:  object-pascal
DiskImageManager
Visual inspection tool for .dsk Spectrum/Amstrad disk images
Stars: ✭ 37 (-70.87%)
Mutual labels:  lazarus

Deskew

by Marek Mauder
https://galfar.vevb.net/deskew
https://github.com/galfar/deskew

v1.30 2019-06-07

Overview

Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

There are pre-compiled binaries built for these platforms (located in Bin folder): Win64 (deskew.exe), Win32 (deskew32.exe), Linux x86_64 (deskew), macOS x86_64 (deskew-mac), Linux ARM aarch64 (deskew-arm64) and v7 (deskew-arm).

GUI frontend for this CLI tool is available as well (Windows, Linux, and macOS), see GUI's Readme.

License: MPL 2.0

Downloads And Releases

https://github.com/galfar/deskew/releases
https://galfar.vevb.net/deskew#downloads

Usage

Usage:
deskew [-o output] [-a angle] [-b color] [..] input
    input:         Input image file
  Options:
    -o output:     Output image file (default: out.png)
    -a angle:      Maximal expected skew angle (both directions) in degrees (default: 10)
    -b color:      Background color in hex format RRGGBB|LL|AARRGGBB (default: black)
  Ext. options:
    -q filter:     Resampling filter used for rotations (default: linear,
                   values: nearest|linear|cubic|lanczos)
    -t a|treshold: Auto threshold or value in 0..255 (default: a)
    -r rect:       Skew detection only in content rectangle (pixels):
                   left,top,right,bottom (default: whole page)
    -f format:     Force output pixel format (values: b1|g8|rgb24|rgba32)
    -l angle:      Skip deskewing step if skew angle is smaller (default: 0.01)
    -g flags:      Operational flags (any combination of):
                   c - auto crop, d - detect only (no output to file)
    -s info:       Info dump (any combination of):
                   s - skew detection stats, p - program parameters, t - timings
    -c specs:      Output compression specs for some file formats. Several specs
                   can be defined - delimited by commas. Supported specs:
                   jXX - JPEG compression quality, XX is in range [1,100(best)]
                   tSCHEME - TIFF compression scheme: none|lzw|rle|deflate|jpeg|g4

  Supported file formats
    Input:  BMP, JPG, PNG, JNG, GIF, DDS, TGA, PBM, PGM, PPM, PAM, PFM, TIF, PSD
    Output: BMP, JPG, PNG, JNG, GIF, DDS, TGA, PGM, PPM, PAM, PFM, TIF, PSD

Notes

For TIFF support in Linux and macOS you need to have libtiff 4.x installed (package is usually called libtiff5).

For macOS you can download prebuilt libtiff binaries here: https://galfar.github.io/store/TiffLibBins-macOS.zip. Just put the files inside the archive to the same folder as deskew-mac executable.

On ARM targets linking to libtiff is disabled at the moment (known to crash with deskew). If you want to try yourself enable it in ImagingTiff.pas unit.

You can find some test images in TestImages folder and scripts to run tests (RunTests.bat and runtests.sh) in Bin. By default scripts just call deskew command but you can pass a different one as a parameter (e.g. runtests.sh deskew-arm).

Bugs, Issues, Proposals

File them here:
https://github.com/galfar/deskew/issues

Version History

v1.30 2019-06-07:

  • fix #15: Better image quality after rotation - better default and also selectable nearest|linear|cubic|lanczos filtering
  • fix #5: Detect skew angle only (no rotation done) - optionally only skew detection
  • fix #17: Optional auto-crop after rotation
  • fix #3: Command line option to set output compression - now for TIFF and JPEG
  • fix #12: Bad behavior when an output is given and no deskewing is needed
  • libtiff in macOS is now picked up also when binaries are put directly in the directory with deskew
  • text output is flushed after every write (Linux/Unix): it used to be flushed only when writing to device but not file/pipe.

v1.25 2018-05-19:

  • fix #6: Preserve DPI measurement system (TIFF)
  • fix #4: Output image not saved in requested format (when deskewing is skipped)
  • dynamic loading of libtiff library - adds TIFF support in macOS when libtiff is installed

v1.21 2017-11-01:

  • fix #8: Cannot compile in Free Pascal 3.0+ (Windows) - Fails to link precompiled LibTiff library
  • fix #7: Windows FPC build fails with Access violation exception when loading certain TIFFs (especially those saved by Windows Photo Viewer etc.)

v1.20 2016-09-01:

  • much faster rotation, especially when background color is set (>2x faster, 2x less memory)
  • can skip deskewing step if detected skew angle is lower than parameter
  • new option for timing of individual steps
  • fix: crash when last row of page is classified as text
  • misc: default back color is now opaque black, new forced output format "rgb24", background color can define also alpha channel, nicer formatting of text output

v1.10 2014-03-04:

  • TIFF support for Win64 and 32/64bit Linux
  • forced output formats
  • fix: output file names were always lowercase
  • fix: preserves resolution metadata (e.g. 300dpi) of input when writing output

v1.00 2012-06-04:

  • background color
  • "area of interest" content rectangle
  • 64bit and Mac OSX support
  • PSD and TIFF (win32) support
  • show skew detection stats and program parameters

v0.95 2010-12-28:

  • Added auto thresholding

v0.90 2010-02-12:

  • Initial version

Compiling Deskew

Deskew is written in Object Pascal. You need Free Pascal or Delphi to recompile it.

Tested Compilers

There are project files for these IDEs:

  1. Lazarus 2.2.2 (deskew.lpi)
  2. Delphi XE + 10.3 (deskew.dproj)

Additionally, there are compile shell/batch scripts for standalone FPC compiler in Scripts folder.

Supported/Tested Platforms

Deskew can be compiled and was tested on these platforms: Win32, Win64, Linux x86_64, macOS x86_64, Linux ARM aarch64 + v7.

Source Code

Latest source code can be found here:
https://github.com/galfar/deskew

Dependencies

Vampyre Imaging Library is needed for compilation and it's included in Deskew's repo in Imaging folder.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].