roofEdge {DRIP} | R Documentation |
Detect roof/valley edges in an image using piecewise local linear kernel smoothing.
roofEdge(image, bandwidth, thresh, edge1, blur, plot)
image |
A square matrix object of size n by n, no missing value allowed. |
bandwidth |
A positive integer to specify the number of pixels used in the local smoothing. |
thresh |
Threshold value used in the edge detection criterion. |
edge1 |
Step edges. The function excludes step edges when detects roof/valley 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. |
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.
data(peppers)
# 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
#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))