Package boofcv.alg.filter.binary
Class LinearExternalContours
- java.lang.Object
-
- boofcv.alg.filter.binary.LinearExternalContours
-
public class LinearExternalContours extends java.lang.ObjectFinds 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
Constructors Constructor Description LinearExternalContours(boofcv.struct.ConnectRule rule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boofcv.struct.ConnectRulegetConnectRule()boofcv.struct.PackedSetsPoint2D_I32getExternalContours()intgetMaxContourLength()intgetMinContourLength()voidprocess(boofcv.struct.image.GrayU8 binary, int adjustX, int adjustY)Detects contours inside the binary image.voidsetConnectRule(boofcv.struct.ConnectRule rule)voidsetMaxContourLength(int maxContourLength)voidsetMinContourLength(int minContourLength)
-
-
-
Method Detail
-
process
public void process(boofcv.struct.image.GrayU8 binary, int adjustX, int adjustY)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
public boofcv.struct.ConnectRule getConnectRule()
-
setConnectRule
public void setConnectRule(boofcv.struct.ConnectRule rule)
-
getExternalContours
public boofcv.struct.PackedSetsPoint2D_I32 getExternalContours()
-
getMaxContourLength
public int getMaxContourLength()
-
setMaxContourLength
public void setMaxContourLength(int maxContourLength)
-
getMinContourLength
public int getMinContourLength()
-
setMinContourLength
public void setMinContourLength(int minContourLength)
-
-