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

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 
#> 170.7656 186.1319 900.3028 455.6520