README.md

image.ContourDetector - Unsupervised Smooth Contour Line Detection for images

The image.ContourDetector R package implements Unsupervised Smooth Contour Line Detection for images.

Examples

Read in an image with values in the 0-255 range (pgm image: http://netpbm.sourceforge.net/doc/pgm.html)

library(image.ContourDetector)
library(pixmap)
imagelocation <- system.file("extdata", "image.pgm", package="image.ContourDetector")
image <- read.pnm(file = imagelocation, cellres = 1)
x     <- image@grey * 255
contourlines <- image_contour_detector(x)
contourlines
plot(image)
plot(contourlines)

If you have another type of image (jpg, png, ...). Convert the image to portable grey format before applying the function

library(magick)
x   <- image_read(system.file("extdata", "atomium.jpg", package="image.ContourDetector"))
mat <- image_data(x, channels = "gray")
mat <- as.integer(mat, transpose = TRUE)
mat <- drop(mat)
contourlines <- image_contour_detector(mat)
plot(contourlines)

plt <- image_draw(x)
contourlines$data$y <- image_info(x)$height - contourlines$data$y
plot(contourlines, add = TRUE, col = "red", lwd = 3)
dev.off()

Support in image recognition

Need support in image recognition? Contact BNOSAC: http://www.bnosac.be



Try the image.ContourDetector package in your browser

Any scripts or data that you put into this service are public.

image.ContourDetector documentation built on July 27, 2020, 5:07 p.m.