R/RcppExports.R

Defines functions dtt_fast

Documented in dtt_fast

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @title Rcpp implementation of Felzenszwalb distance transfom
#' @description Rcpp wrapper for the distance transform algorithm described in Felzenszwalb and Huttenlocher (2012)
#' @param x matrix of booleans of size \eqn{n x m} representing a (binary) image
#' @return A matrix of size \eqn{n x m} containing the distance transform result. Note that this function does not perform any checks on \code{x}.
#' @author Pedro Felzenszwalb for the header files \code{dt.h} and \code{misc.h} that do the work, Dario Azzimonti and Julien Bect for the wrapper.
#' @references  Felzenszwalb, P. F. and Huttenlocher, D. P. (2012). Distance Transforms of Sampled Functions. Theory of Computing, 8(19):415-428.
#' @examples
#' # Create an image with a square
#' nc = 256
#' nr = 256
#' xx = matrix(FALSE,ncol=nc,nrow=nr)
#' xx[(nr/16):(nr/16*15-1),nc/16]<-rep(TRUE,nr/16*14)
#' xx[(nr/16):(nr/16*15-1),nc/16*15]<-rep(TRUE,nr/16*14)
#' xx[nr/16,(nc/16):(nc/16*15-1)]<-rep(TRUE,nc/16*14)
#' xx[nr/16*15,(nc/16):(nc/16*15-1)]<-rep(TRUE,nc/16*14)
#' # Compute Distance transform
#' zz<- dtt_fast(xx)
#' \donttest{
#' # Plot the results
#' image(xx,col=grey.colors(20), main="Original image")
#' image(zz,col=grey.colors(20), main="Distance transform")
#' }
#' @export
dtt_fast <- function(x) {
    .Call('_pGPx_dtt_fast', PACKAGE = 'pGPx', x)
}

Try the pGPx package in your browser

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

pGPx documentation built on Aug. 23, 2023, 5:09 p.m.