thresholding: Convert image to binary image

Description Usage Arguments Details Value See Also Examples

Description

This function converts an image (rgb, grayscale or numeric) to binary by applying a thresholding function to it. 3-channels images (rgb and numeric) are first converted to 1-channel images (grayscale or numeric) prior to applying the thresholding function.

Usage

1

Arguments

image

A vpImage object to convert to a binary image.

thres

The threshold value to separate the pixels of the image in two groups.

type

The type of thresholding function to apply to the image. If set to "binary", then the pixels above thres are replaced with ones and those below are replaced with zeros. If set to "inverted", then the pixels above thres are replaced with zeros and those below are replaced with ones.

Details

The vpImage object created by the thresholding function is not a persistent object, but a pointer to a C++ object that cannot be saved for reuse in a different session.

Value

This function returns a vpImage object.

See Also

vpImage

Examples

1
2
3
4
5
6
7
filename <- system.file("sample_img/SampleVideo_1080x720_5mb.png", package = "videoplayR")
img <- readImg(filename)
imshow(img)
bin <- thresholding(img, 128, "binary")
imshow(bin)
inv <- thresholding(img, 128, "inverted")
imshow(inv)

swarm-lab/videoplayR documentation built on May 30, 2019, 9:36 p.m.