Search in sources :

Example 1 with BinaryContourFinder

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);
}
Also used : PointsToPolyline(boofcv.abst.shapes.polyline.PointsToPolyline) BinaryContourFinder(boofcv.abst.filter.binary.BinaryContourFinder) FactoryBinaryContourFinder(boofcv.factory.filter.binary.FactoryBinaryContourFinder)

Example 2 with BinaryContourFinder

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);
}
Also used : BinaryContourFinder(boofcv.abst.filter.binary.BinaryContourFinder)

Example 3 with BinaryContourFinder

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);
}
Also used : BinaryContourFinder(boofcv.abst.filter.binary.BinaryContourFinder)

Example 4 with BinaryContourFinder

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;
}
Also used : Contour(boofcv.alg.filter.binary.Contour) BinaryContourFinder(boofcv.abst.filter.binary.BinaryContourFinder)

Example 5 with BinaryContourFinder

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);
}
Also used : BinaryContourFinder(boofcv.abst.filter.binary.BinaryContourFinder)

Aggregations

BinaryContourFinder (boofcv.abst.filter.binary.BinaryContourFinder)9 FactoryBinaryContourFinder (boofcv.factory.filter.binary.FactoryBinaryContourFinder)2 PointsToPolyline (boofcv.abst.shapes.polyline.PointsToPolyline)1 Contour (boofcv.alg.filter.binary.Contour)1 GrayS32 (boofcv.struct.image.GrayS32)1