image_textlines_crop {image.textlinedetector}R Documentation

Crop an image to extract only the region containing text

Description

Applies a sequence of image operations to obtain a region which contains relevant texts by cropping white space on the borders of the image. This is done in the following steps: morphological opening, morphological closing, blurring, canny edge detection, convex hull contours of the edges, keep only contours above the mean contour area, find approximated contour lines of the convex hull contours of these, dilation and thresholding.

Usage

image_textlines_crop(x)

Arguments

x

an object of class magick-image

Value

an object of class magick-image

Examples


library(opencv)
library(magick)
library(image.textlinedetector)
path  <- system.file(package = "image.textlinedetector", "extdata", "example.png")
img   <- image_read(path)
image_info(img)
img   <- image_textlines_crop(img)
image_info(img)


[Package image.textlinedetector version 0.2.3 Index]