Learn R Programming

image.textlinedetector (version 0.2.3)

image_textlines_crop: 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)

Value

an object of class magick-image

Arguments

x

an object of class magick-image

Examples

Run this code
# \donttest{
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)
# }

Run the code above in your browser using DataLab