Skip to content

Commit

Permalink
Add function to compute Gabor kernels.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmgarnier committed Sep 12, 2022
1 parent 2ffab3d commit b4237a1
Show file tree
Hide file tree
Showing 15 changed files with 550 additions and 16 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export(fps)
export(frame)
export(full)
export(gaussianBlur)
export(getGaborKernel)
export(getPerspectiveTransform)
export(getProp)
export(getTextSize)
Expand Down
2 changes: 1 addition & 1 deletion R/ImageClass.R
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ readMulti <- function(x, colorspace = "BGR") {
}


#' @title Wrtie a Multi-Page Image
#' @title Write a Multi-Page Image
#'
#' @description \code{writeMulti} writes a list of \code{\link{Image}} objects
#' to a multi-page image.
Expand Down
39 changes: 39 additions & 0 deletions R/filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -1363,3 +1363,42 @@ invert <- function(image, target = "new", in_place = NULL) {
stop("Invalid target.")
}
}


#' @title Gabor Filter Kernels
#'
#' @description \code{getGaborKernel} is a convenience function to create Gabor
#' kernels that can be used to filter images with \code{\link{filter2D}}.
#'
#' @param width The width in pixels of the kernel (default: 31).
#'
#' @param height The height in pixels of the kernel (default: 31).
#'
#' @param sigma The standard deviation of the Gaussian envelope (default: 5).
#'
#' @param theta The orientation of the normal to the parallel stripes of a Gabor
#' function (default: \code{\link{pi}}).
#'
#' @param lambda The wavelength of the sinusoidal factor (default: 31).
#'
#' @param gamma The spatial aspect ratio (default: 5).
#'
#' @param psi A phase offset (default: 0).
#'
#' @return A matrix of Gabor coefficients.
#'
#' @note For more details about Gabor filter equations and parameters,
#' see: \href{https://en.wikipedia.org/wiki/Gabor_filter}{Gabor filter}.
#'
#' @author Simon Garnier, \email{garnier@@njit.edu}
#'
#' @seealso \code{\link{filter2D}}
#'
#' @examples
#' getGaborKernel()
#'
#' @export
getGaborKernel <- function(width = 31, height = 31, sigma = 5, theta = pi,
lambda = 31, gamma = 5, psi = 0) {
`_getGaborKernel`(width, height, sigma, theta, lambda, gamma, psi)
}
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ articles:
z4_inplace: z4_inplace.html
z5_gpu: z5_gpu.html
z6_queue: z6_queue.html
last_built: 2022-09-01T18:20Z
last_built: 2022-09-12T12:43Z
urls:
reference: https://swarm-lab.github.io/ROpenCVLite/reference
article: https://swarm-lab.github.io/ROpenCVLite/articles
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/convexHull.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/reference/fitEllipse.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4237a1

Please sign in to comment.