Skip to contents

Detect the water-sensitive paper in RGB images using a pre-trained SURF (Speed Up Robust Features) descriptor.

Usage

detectPaper(x, paper_dim = c(76, 26), display.it = TRUE)

Arguments

x

Either an object of class Image from package EBImage or a character indicating the path to the image file (.jpg, .jpeg, .png, .tif).

paper_dim

A numeric vector of length 2 indicating the length and width (in mm) of the water-sensitive paper.

display.it

(Logical) Should the image with the bounding box of the paper be displayed? Default is TRUE.

Value

An object of class Image. An additional attribute containing the bounding box for the paper is stored. See Examples.

See also

Examples

path <- system.file('images', 'field1.jpg', package = 'hydropaper')
p1 <- detectPaper(path)

attr(p1, 'paper_bbox')
#>     xmin     ymin     xmax     ymax 
#> 164.3195 181.5461 861.3250 455.7085