image_wordsegmentation: Find Words by Connected Components Labelling

View source: R/textlinedetector.R

image_wordsegmentationR Documentation

Find Words by Connected Components Labelling

Description

Filter the image using the gaussian kernel and extract components which are connected which are to be considered as words.

Usage

image_wordsegmentation(x, kernelSize = 11L, sigma = 11L, theta = 7L)

Arguments

x

an object of class opencv-image containing black/white binary data (type CV_8U1)

kernelSize

size of the kernel

sigma

sigma of the kernel

theta

theta of the kernel

Value

a list with elements

  • n: the number of lines found

  • overview: an opencv-image of the detected areas

  • words: a list of opencv-image's, one for each word area

Examples


library(opencv)
library(magick)
library(image.textlinedetector)
path  <- system.file(package = "image.textlinedetector", "extdata", "example.png")
img   <- image_read(path)
img   <- image_resize(img, "x1000")
areas <- image_textlines_flor(img, light = TRUE, type = "sauvola")
areas$overview
areas$textlines[[6]]
textwords <- image_wordsegmentation(areas$textlines[[6]])
textwords$n
textwords$overview
textwords$words[[2]]
textwords$words[[3]]


image.textlinedetector documentation built on Nov. 10, 2023, 1:09 a.m.