| image_crop_textpolygons | R Documentation | 
Crop out areas with text polygons from an image
image_crop_textpolygons( image, geometries, color = "royalblue", border = "10x10", overview = TRUE, max_width = +Inf, trace = FALSE )
| image | 
 | 
| geometries | a data.frame with columns width, height, x_left, y_top indicating the areas to extract from the image | 
| color | color to use for adding a border in the overview image. Defaults to 'royalblue'. | 
| border | border pixels to using in the overview image. Defaults to 10x10 pixel borders. | 
| overview | logical indicating to add the overview image of all area's below each other. Defaults to TRUE. | 
| max_width | maximum width of the overview image. Defaults to +Inf | 
| trace | logical indicating to trace progress | 
a list with elements areas and overview where overview is a magick-image with stacked image lines
and areas is a list of magick-image's, one for each text line 
In case overview is set to FALSE the return value is only the list of stacked image lines.
library(opencv) library(data.table) path <- system.file(package = "madoc.utils", "extdata", "pagexml-example.xml") x <- read_pagexml(path) img <- system.file(package = "madoc.utils", "extdata", "pagexml-example.jpg") img <- ocv_read(img) area <- ocv_polygon(img, pts = x$coords[[5]]) areas <- image_crop_textpolygons(img, x, color = "red") areas$overview areas$areas
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.