Search in sources :

Example 1 with ConfigHoughFootSubimage

use of boofcv.factory.feature.detect.line.ConfigHoughFootSubimage in project BoofCV by lessthanoptimal.

the class DetectLineApp method declareDetector.

private void declareDetector() {
    synchronized (lockDetector) {
        lineDetector = null;
        segmentDetector = null;
        ConfigHoughGradient configGradient = new ConfigHoughGradient();
        configGradient.maxLines = controls.maxLines;
        switch(controls.whichAlg) {
            case 0:
                lineDetector = FactoryDetectLine.houghLinePolar(configGradient, null, imageType);
                break;
            case 1:
                lineDetector = FactoryDetectLine.houghLineFoot(configGradient, null, imageType);
                break;
            case 2:
                lineDetector = FactoryDetectLine.houghLineFootSub(new ConfigHoughFootSubimage(3, 8, 5, edgeThreshold, controls.maxLines, 2, 2), imageType);
                break;
            case 3:
                segmentDetector = FactoryDetectLine.lineRansac(new ConfigLineRansac(40, 30, 2.36, true), imageType);
                break;
        }
    }
}
Also used : ConfigLineRansac(boofcv.factory.feature.detect.line.ConfigLineRansac) ConfigHoughGradient(boofcv.factory.feature.detect.line.ConfigHoughGradient) ConfigHoughFootSubimage(boofcv.factory.feature.detect.line.ConfigHoughFootSubimage)

Example 2 with ConfigHoughFootSubimage

use of boofcv.factory.feature.detect.line.ConfigHoughFootSubimage in project BoofCV by lessthanoptimal.

the class ExampleLineDetection method detectLines.

/**
 * Detects lines inside the image using different types of Hough detectors
 *
 * @param buffered Input image.
 * @param imageType Type of image processed by line detector.
 */
public static <T extends ImageGray<T>> void detectLines(BufferedImage buffered, Class<T> imageType) {
    // convert the line into a single band image
    T input = ConvertBufferedImage.convertFromSingle(buffered, null, imageType);
    T blurred = input.createSameShape();
    // Blur smooths out gradient and improves results
    GBlurImageOps.gaussian(input, blurred, 0, 5, null);
    // Detect edges of objects using gradient based hough detectors. If you have nice binary lines which are thin
    // there's another type of hough detector available
    DetectLine<T> detectorPolar = FactoryDetectLine.houghLinePolar(new ConfigHoughGradient(maxLines), null, imageType);
    DetectLine<T> detectorFoot = FactoryDetectLine.houghLineFoot(new ConfigHoughGradient(maxLines), null, imageType);
    DetectLine<T> detectorFootSub = FactoryDetectLine.houghLineFootSub(new ConfigHoughFootSubimage(3, 8, 5, edgeThreshold, maxLines, 2, 2), imageType);
    detectLines(buffered, blurred, detectorPolar, "Hough Polar");
    detectLines(buffered, blurred, detectorFoot, "Hough Foot");
    detectLines(buffered, blurred, detectorFootSub, "Hough Foot-Sub");
}
Also used : ConfigHoughGradient(boofcv.factory.feature.detect.line.ConfigHoughGradient) ConfigHoughFootSubimage(boofcv.factory.feature.detect.line.ConfigHoughFootSubimage)

Aggregations

ConfigHoughFootSubimage (boofcv.factory.feature.detect.line.ConfigHoughFootSubimage)2 ConfigHoughGradient (boofcv.factory.feature.detect.line.ConfigHoughGradient)2 ConfigLineRansac (boofcv.factory.feature.detect.line.ConfigLineRansac)1