Skip to contents

Applies the Sobel-Feldman Operator to detect edges. The operator is based on convolving the image with a small, separable, and integer-valued filter in the horizontal and vertical directions.

Usage

object_edge(img, sigma = 1, threshold = "Otsu", thinning = FALSE, plot = TRUE)

Arguments

img

An image or a list of images of class Image.

sigma

Gaussian kernel standard deviation used in the gaussian blur.

threshold

The theshold method to be used. If threshold = "Otsu" (default), a threshold value based on Otsu's method is used to reduce the grayscale image to a binary image. If any non-numeric value different than "Otsu" is used, an iterative section will allow you to choose the threshold based on a raster plot showing pixel intensity of the index. Alternatively, provide a numeric value to be used as the threshold value.

thinning

Logical value indicating whether a thinning procedure should be applied to the detected edges. See image_skeleton()

plot

Logical value indicating whether a plot should be created

Value

A binary version of image.

References

Sobel, I., and G. Feldman. 1973. A 3×3 isotropic gradient operator for image processing. Pattern Classification and Scene Analysis: 271–272.

Examples

if (interactive() && requireNamespace("EBImage")) {
library(pliman)
img <- image_pliman("sev_leaf_nb.jpg", plot = TRUE)
object_edge(img)
}