roofEdge: Roof Edge Detector

View source: R/roofEdge.r

roofEdgeR Documentation

Roof Edge Detector

Description

Detect roof/valley edges in an image using piecewise local quadratic kernel smoothing.

Usage

roofEdge(image, bandwidth, thresh, edge1, blur, plot)

Arguments

image

A square matrix, no missing value allowed.

bandwidth

A positive integer that specifies the number of pixels to use in the local smoothing.

thresh

Threshold value to use in the edge detection criterion.

edge1

A square matrix representing the image's step edges. The function excludes step edges when detects roof edges.

blur

If blur = TRUE, besides the conventional 2-D kernel function, a univariate kernel function is used in the local smoothing to address the issue of blur.

plot

If plot = TRUE, an image of detected edges is plotted.

Details

At each pixel, the second-order derivarives (i.e., f''_{xx}, f''_{xy}, and f''_{yy}) are estimated by a local quadratic kernel smoothing procedure. Next, the local neighborhood is first divided into two halves along the direction perpendicular to (\widehat{f}''_{xx}, \widehat{f}''_{xy}). Then the one-sided estimates of f'_{x+} and f'_{x-} are obtained respectively by local linear kernel smoothing. The estimates of f'_{y+} and f'_{y-} are obtained by the same procedure except that the neighborhood is divided along the direction perpendicular to (\widehat{f}''_{xy}, \widehat{f}''_{yy}). The pixel is flagged as a roof/valley edge pixel if max(|\widehat{f}_{x+} - \widehat{f}_{x-}|, |\widehat{f}_{y+} - \widehat{f}_{y-}|)> the specified threshold and there is no step edge pixels in the neighborhood.

Value

A matrix of zeros and ones of the same size as the input image.

References

Qiu, P. and Kang, Y. (2015) “Blind Image Deblurring Using Jump Regression Analysis”, Statistica Sinica, 25, 879 – 899, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5705/ss.2014.054")}.

See Also

roofEdgeParSel, roofDiff

Examples

data(peppers)
## Not run: 
step.edges <- stepEdge(peppers, bandwidth = 6, thresh = 25, degree = 1)
roof.edges <- roofEdge(image = peppers, bandwidth = 9, thresh = 3000,
    edge1 = step.edges, blur = FALSE, plot = FALSE) # Time consuming
edges <- step.edges + roof.edges     
par(mfrow = c(2, 2))
image(1 - step.edges, col = gray(0:1))
image(1 - roof.edges, col = gray(0:1))
image(1 - edges, col = gray(0:1))
image(peppers, col = gray(c(0:255)/255))

## End(Not run)

DRIP documentation built on May 29, 2024, 4:56 a.m.

Related to roofEdge in DRIP...