Package boofcv.alg.filter.binary
Class LinearExternalContours
java.lang.Object
boofcv.alg.filter.binary.LinearExternalContours
Finds the external contours of binary blobs in linear time. No label image is required. Designed to quickly
move through regions with repeat values of 0 and 1. Input image is modified. The outside border is set to zero
and the value of contour pixels is set to -1 or -2 to indicate that it has been processed. This algorithm is
highly specialized but follows a similar pattern to other finding/tracing algorithms from [1] and [2].
Algorithm:
- Fill in image border with zeros
- Start at pixel x=1,y=1
- Begin Row: Starting at (x,y) scan for a value of not zero. Let this point be (x,y)
- Trace contour. This contour must be an external contour and is saved.
- Resume scanning the row starting at (x+1,y) for a pixel with a value of zero. This pixel will now be (x,y)
- If the pixel (x-1,y) has a value of 1 trace the inner contour. Otherwise move to next step.
- Iterate from "Begin Row" until the end of the row has been reached
- Move to the next row starting at point (1,y+1)
getExternalContours()
.
[1] Fu Chang and Chun-jen Chen and Chi-jen Lu, "A linear-time component-labeling algorithm using contour
tracing technique" Computer Vision and Image Understanding, 2004
[2] Rosenfeld, Azriel. "Digital topology." American Mathematical Monthly (1979): 621-630.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Detects contours inside the binary image.void
setConnectRule
(ConnectRule rule)
-
Constructor Details
-
LinearExternalContours
-
-
Method Details
-
process
Detects contours inside the binary image.- Parameters:
binary
- Binary image. Will be modified. See class descriptionadjustX
- adjustment applied to coordinate in binary image for contour. 0 or 1 is typicaladjustY
- adjustment applied to coordinate in binary image for contour. 0 or 1 is typical
-
getConnectRule
-
setConnectRule
-
getExternalContours
-