Image Processing Functionality using the 'dlib' Package

Facility wrappers around the image processing functionality of 'dlib'. 'Dlib' < http://dlib.net> is a 'C++' toolkit containing machine learning algorithms and computer vision tools. Currently the package allows to find feature descriptors of digital images, in particular 'SURF' and 'HOG' descriptors.


image.dlib

The image.dlib package allows to quickly obtain image features (SURF and HOG features) and to do image matching.

Examples

library(magick)
library(image.dlib)

## Read 2 images
img1   <- image_read("input_0.png")
img2   <- image_read("input_1.png")
height <- image_info(img1)$height
## Get the surf descriptors
sp1 <- image_surf(image_data(img1, channels = "rgb"), max_points = 50)
sp2 <- image_surf(image_data(img2, channels = "rgb"), max_points = 50)

## Match surf points 
library(FNN)
knn <- get.knnx(sp1$surf, sp2$surf, k = 1)

## Plot the 2 images and the top 15 matches of the SURF points
combined <- image_append(c(img1, img2), stack = TRUE)
plt <- image_draw(combined)
points(sp1$x, sp1$y, col = "red", pch = 20)
points(sp2$x, sp2$y + height, col = "blue", pch = 20)
for(i_from in head(order(knn$nn.dist), 15)){
  i_to   <- knn$nn.index[i_from]
  lines(x = c(sp1$x[i_to], sp2$x[i_from]), y = c(sp1$y[i_to], sp2$y[i_from] + height), col = "red")
}
dev.off()
plt
  • Look to the documentation of the R package for examples: help(package = image.dlib)

Support in image recognition

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

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("image.dlib")

0.1.1 by Jan Wijffels, 4 years ago


https://github.com/bnosac/image


Browse source code at https://github.com/cran/image.dlib


Authors: Jan Wijffels [aut, cre, cph] (R wrapper) , BNOSAC [cph] (R wrapper) , Davis E. King [ctb, cph] (Main contributor of dlib - files in inst/dlib) , dlib authors [ctb, cph] (see file AUTHORS)


Documentation:   PDF Manual  


BSL-1.0 license


Imports Rcpp

Suggests magick, FNN

Linking to Rcpp

System requirements: C++17


See at CRAN