# \donttest{
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_astar(img, morph = TRUE, step = 2, mfactor = 5, trace = TRUE)
areas <- lines(areas, img)
areas$n
areas$overview
areas$lines
areas$textlines[[2]]
areas$textlines[[4]]
combined <- lapply(areas$textlines, FUN=function(x) image_read(ocv_bitmap(x)))
combined <- do.call(c, combined)
combined
image_append(combined, stack = TRUE)
# }
# \donttest{
plt <- image_draw(img)
lapply(areas$paths, FUN=function(line){
lines(x = line$x, y = line$y, col = "red")
})
dev.off()
plt
# }
Run the code above in your browser using DataLab