Learn R Programming

videoplayR (version 0.3.1)

blobDetector: Find blobs in binary image

Description

This function finds blobs in binary images. A blob is defined as a group of 8-connected white pixels on a black background.

Usage

blobDetector(image)

Arguments

image
A binary vpImage object, for instance one obtained from the thresholding function.

Value

This function returns a data frame with one row per blob detected in the image and seven columns corresponding to the seven following properties of each blob:
  • "id": identity of the blob.
  • "x": x coordinate of the center of the ellipse approximating the shape of the blob.
  • "y": y coordinate of the center of the ellipse approximating the shape of the blob.
  • "alpha": orientation in degrees of the major axis of the ellipse.
  • "major": length of the major axis of the ellipse.
  • "minor": length of the minor axis of the ellipse.
  • "area": area of the polygon containing the blob.

See Also

thresholding

Examples

Run this code
require(plotrix)
filename <- system.file("sample_img/dots.jpg", package = "videoplayR")
img <- readImg(filename)
bw <- thresholding(img, 200, "inverted")
blobs <- blobDetector(bw)

imshow(img)
points(y ~ x, data = blob, col = "red", pch = 20)
draw.ellipse(blob$x, blob$y, blob$major / 2, blob$minor / 2, blob$alpha, border = "red")

Run the code above in your browser using DataLab