use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class BaseDetectFiducialSquare method configureContourDetector.
/**
* Configures the contour detector based on the image size. Setting a maximum contour and turning off recording
* of inner contours and improve speed and reduce the memory foot print significantly.
*/
private void configureContourDetector(T gray) {
// determine the maximum possible size of a square based on image size
int maxContourSize = Math.min(gray.width, gray.height) * 4;
BinaryContourFinder contourFinder = squareDetector.getDetector().getContourFinder();
contourFinder.setMaxContour(maxContourSize);
contourFinder.setSaveInnerContour(false);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class DetectSquareGridFiducial method configureContourDetector.
/**
* Configures the contour detector based on the image size. Setting a maximum contour and turning off recording
* of inner contours and improve speed and reduce the memory foot print significantly.
*/
private void configureContourDetector(T gray) {
// determine the maximum possible size of a square when viewed head on
// this doesn't take in account the spacing between squares and will be an over estimate
int maxContourSize = Math.max(gray.width, gray.height) / Math.max(numCols, numRows);
BinaryContourFinder contourFinder = detectorSquare.getDetector().getContourFinder();
contourFinder.setMaxContour(maxContourSize * 4 * 2);
contourFinder.setSaveInnerContour(false);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class BinaryImageOps method contour.
/**
* <p>
* Given a binary image, connect together pixels to form blobs/clusters using the specified connectivity rule.
* The found blobs will be labeled in an output image and also described as a set of contours. Pixels
* in the contours are consecutive order in a clockwise or counter-clockwise direction, depending on the
* implementation. The labeled image will assign background pixels a label of 0 and each blob will be
* assigned a unique ID starting from 1.
* </p>
*
* <p>
* The returned contours are traces of the object. The trace of an object can be found by marking a point
* with a pen and then marking every point on the contour without removing the pen. It is possible to have
* the same point multiple times in the contour.
* </p>
*
* @see LinearContourLabelChang2004
*
* @param input Input binary image. Not modified.
* @param rule Connectivity rule. Can be 4 or 8. 8 is more commonly used.
* @param output (Optional) Output labeled image. If null, an image will be declared internally. Modified.
* @return List of found contours for each blob.
*/
public static List<Contour> contour(GrayU8 input, ConnectRule rule, GrayS32 output) {
if (output == null) {
output = new GrayS32(input.width, input.height);
} else {
InputSanityCheck.checkSameShape(input, output);
}
BinaryContourFinder alg = FactoryBinaryContourFinder.linearChang2004();
alg.setConnectRule(rule);
alg.process(input, output);
return convertContours(alg);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class DetectCircleRegularGrid method configureContourDetector.
@Override
protected void configureContourDetector(T gray) {
// overestimate the max diameter by not taking in account space between the circles
int diameter = Math.max(gray.width, gray.height) / Math.max(numCols, numRows);
BinaryContourFinder contourFinder = ellipseDetector.getEllipseDetector().getContourFinder();
contourFinder.setMaxContour((int) (Math.PI * diameter) * 2);
contourFinder.setSaveInnerContour(false);
}
Aggregations