The function attempts to fill in edge discontinuities in order to enable normal labeling and edge detection.
fillLineGaps(
contours,
objects = NULL,
threshold = "13%",
alpha = 1,
sigma = 2,
radius = 5,
iterations = 2,
visualize = TRUE
)
Image with continuous edges (closed gaps).
image that contains discontinuous lines like edges or contours
image that contains objects that should be removed before applying the fill algorithm
"in %" (from threshold
)
threshold adjustment factor for edge detection
(from edgeDetection
)
smoothing (from edgeDetection
)
maximal radius that should be scanned for another cluster
how many times the algorithm should find line ends and reconnect them to their closest neighbor
if TRUE (default) a plot is displayed highlighting the added pixels in the original image
The function pre-processes the image in order to enable the implementation
of the adaptiveInterpolation
function. The
pre-processing stage encompasses a number of operations, including
thresholding, the optional removal of objects, the detection of line ends
and diagonal line ends, and the labeling of pixels. The threshold should be
set to allow for the retention of some "bridge" pixels between gaps, thus
facilitating the subsequent process of reconnection. For further details
regarding the process of reconnection, please refer to the documentation on
adaptiveInterpolation
. The subsequent post-processing
stage entails the reduction of line thickness in the image. With regard to
the possibility of object removal, the coordinates associated with these
objects are collected using the objectDetection
function. Subsequently, the pixels of the detected objects are set to null
in the original image, thus allowing the algorithm to proceed without the
objects.