ocv_deslant | R Documentation |
This algorithm sets handwritten text in images upright by removing cursive writing style.
One can use it as a preprocessing step for handwritten text recognition.
image_deslant
expects a magick-image and performs grayscaling before doing deslanting
ocv_deslant
expects a ocv-image and does not perform grayscaling before doing deslanting
ocv_deslant(image, bgcolor = 255, lower_bound = -1, upper_bound = 1)
image_deslant(image, bgcolor = 255, lower_bound = -1, upper_bound = 1)
image |
an object of class opencv-image (for |
bgcolor |
integer value with the background color to use to fill the gaps of the sheared image that is returned. Defaults to white: 255 |
lower_bound |
lower bound of shear values. Defaults to -1 |
upper_bound |
upper bound of shear values. Defaults to 1 |
an object of class opencv-image or magick-image with the deslanted image
library(magick)
library(opencv)
library(image.textlinedetector)
path <- system.file(package = "image.textlinedetector", "extdata", "cursive.png")
img <- ocv_read(path)
img <- ocv_grayscale(img)
img
up <- ocv_deslant(img)
up
img <- image_read(path)
img
image_deslant(img)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.