use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class FactoryShapeDetector method polygonContour.
public static <T extends ImageGray<T>> DetectPolygonFromContour<T> polygonContour(@Nonnull ConfigPolygonFromContour config, Class<T> imageType) {
config.checkValidity();
PointsToPolyline contourToPolygon = FactoryPointsToPolyline.create(config.contourToPoly);
BinaryContourFinder contour = FactoryBinaryContourFinder.linearChang2004();
contour.setConnectRule(config.contourRule);
return new DetectPolygonFromContour<>(contourToPolygon, config.minimumContour, config.clockwise, config.canTouchBorder, config.minimumEdgeIntensity, config.tangentEdgeIntensity, contour, imageType);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class DetectChessboardSquarePoints 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
int maxContourSize = Math.max(gray.width, gray.height) / Math.max(numCols, numRows);
BinaryContourFinder contourFinder = detectorSquare.getDetector().getContourFinder();
// fisheye distortion can let one square go larger
contourFinder.setMaxContour(maxContourSize * 4 * 2);
contourFinder.setSaveInnerContour(false);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class DetectCircleHexagonalGrid method configureContourDetector.
@Override
protected void configureContourDetector(T gray) {
// overestimate for multiple reasons. Doesn't take in account space and distance between touching circles
// isn't correct
int diameter = Math.max(gray.width, gray.height) / (Math.max(numCols, numRows));
BinaryContourFinder contourFinder = ellipseDetector.getEllipseDetector().getContourFinder();
contourFinder.setMaxContour((int) (Math.PI * diameter * 3) + 1);
contourFinder.setSaveInnerContour(false);
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class DetectCalibrationSquareGridApp method getContours.
@Override
protected List<Contour> getContours() {
BinaryContourFinder contour = alg.getDetectorSquare().getDetector().getContourFinder();
List<Contour> contours = BinaryImageOps.convertContours(contour);
return contours;
}
use of boofcv.abst.filter.binary.BinaryContourFinder in project BoofCV by lessthanoptimal.
the class QrCodePositionPatternDetector 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 position pattern
// contour size is maximum when viewed head one. Assume the smallest qrcode is 3x this width
// 4 side in a square
int maxContourSize = Math.min(gray.width, gray.height) * 4 / 3;
BinaryContourFinder contourFinder = squareDetector.getDetector().getContourFinder();
contourFinder.setMaxContour(maxContourSize);
contourFinder.setSaveInnerContour(false);
}
Aggregations