roofEdge: Edge detection, denoising and deblurring

View source: R/roofEdge.r

roofEdgeR Documentation

Edge detection, denoising and deblurring


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


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



A square matrix object of size n by n, no missing value allowed.


A positive integer to specify the number of pixels used in the local smoothing.


Threshold value used in the edge detection criterion.


Step edges. The function excludes step edges when detects roof/valley edges.


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.


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


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 (\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 thresh and there is no step edge pixels in the neighborhood.


Returns a matrix of zeros and ones of the same size as image.


Qiu, P., and Kang, Y. "Blind Image Deblurring Using Jump Regression Analysis," Statistica Sinica, 25, 2015, 879-899.

See Also

roofEdgeParSel, roofDiff


# Not run
#step.edges <- stepEdgeLLK(peppers, bandwidth=6, thresh=25, plot=FALSE)
#roof.edges <- roofEdge(image=peppers, bandwidth=9, thresh=3000, edge1=step.edges,
#     blur=FALSE, plot=FALSE) # Time consuming
#edges = step.edges + roof.edges     
#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))

DRIP documentation built on Sept. 1, 2023, 5:08 p.m.

Related to roofEdge in DRIP...