Segment Images in Text Lines and Words

Find text lines in scanned images and segment the lines into words. Includes implementations of the paper 'Novel A* Path Planning Algorithm for Line Segmentation of Handwritten Documents' by Surinta O. et al (2014) available at < https://github.com/smeucci/LineSegm>, an implementation of 'A Statistical approach to line segmentation in handwritten documents' by Arivazhagan M. et al (2007) , and a wrapper for an image segmentation technique to detect words in text lines as described in the paper 'Scale Space Technique for Word Segmentation in Handwritten Documents' by Manmatha R. and Srimal N. (1999) paper at , wrapper for code available at < https://github.com/arthurflor23/text-segmentation>. Provides as well functionality to put cursive text in images upright using the approach defined in the paper 'A new normalization technique for cursive handwritten words' by Vinciarelli A. and Luettin J. (2001) .


image.textlinedetector

The image.textlinedetector R package detects text lines in digital images and segments these into words.

Objective of the package is to more easily plug the text lines in Handwritten Text Recognition modelling frameworks like the one explained in this document

The algorithms in this R package implement the following techniques:

  1. An Implementation of a Novel A* Path Planning Algorithm for Line Segmentation of Handwritten Documents paper link
  2. A Statistical approach to line segmentation in handwritten documents paper link
  3. A new normalization technique for cursive handwritten words paper link

More descriptions of technique 2 can be found in this document

Installation

  • For regular users, install the package from your local CRAN mirror install.packages("image.textlinedetector")
  • For installing the development version of this package and to execute the example
install.packages("opencv")
install.packages("magick")
install.packages("image.binarization")
remotes::install_github("DIGI-VUB/image.textlinedetector")

Look to the documentation of the functions

help(package = "image.textlinedetector")

Example

Based on the paper An Implementation of a Novel A* Path Planning Algorithm for Line Segmentation of Handwritten Documents

library(opencv)
library(magick)
library(image.binarization)
library(image.textlinedetector)
#path <- "C:/Users/Jan/Desktop/OCR-HTR/RABrugge_TBO119_693_088.jpg"
path  <- system.file(package = "image.textlinedetector", "extdata", "example.png")
img   <- image_read(path)
img   <- image_binarization(img, type = "su")
areas <- image_textlines_astar(img, morph = TRUE, step = 2, mfactor = 5)
areas <- lines(areas, img, channels = "bgr")
areas$n
areas$overview
areas$lines
areas$textlines[[2]]
areas$textlines[[4]]
combined <- lapply(areas$textlines, FUN = function(x) image_read(ocv_bitmap(x)))
combined <- do.call(c, combined)
combined

Based on the paper A Statistical approach to line segmentation in handwritten documents

library(opencv)
library(magick)
library(image.binarization)
library(image.textlinedetector)
path   <- system.file(package = "image.textlinedetector", "extdata", "example.png")
img    <- image_read(path)
img
img_bw <- image_binarization(img, type = "isauvola")
areas  <- image_textlines_flor(img, light = TRUE, type = "sauvola")
areas$overview
areas$textlines[[6]]
areas  <- lines(areas, img_bw, channels = "gray")
textwords <- image_wordsegmentation(areas$textlines[[10]])
textwords$n
textwords$overview
textwords$words[[2]]
textwords$words[[3]]
combined <- lapply(textwords$words, FUN = function(x) image_read(ocv_bitmap(x)))
combined <- do.call(c, combined)
combined

DIGI

By DIGI: Brussels Platform for Digital Humanities: https://digi.research.vub.be

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("image.textlinedetector")

0.2.3 by Jan Wijffels, 3 years ago


https://github.com/DIGI-VUB/image.textlinedetector


Browse source code at https://github.com/cran/image.textlinedetector


Authors: Jan Wijffels [aut, cre, cph] (R wrapper) , Vrije Universiteit Brussel - DIGI: Brussels Platform for Digital Humanities [cph] (R wrapper) , Jeroen Ooms [ctb, cph] (More details in LICENSE.note file) , Arthur Flôr [ctb, cph] (More details in LICENSE.note file) , Saverio Meucci [ctb, cph] (More details in LICENSE.note file) , Yeara Kozlov [ctb, cph] (More details in LICENSE.note file) , Tino Weinkauf [ctb, cph] (More details in LICENSE.note file) , Harald Scheidl [ctb, cph] (More details in LICENSE.note file)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, magick

Suggests opencv

Linking to Rcpp

System requirements: C++17 or C++11 and OpenCV 3 or newer: libopencv-dev (Debian, Ubuntu) or opencv-devel (Fedora)


See at CRAN