Search in sources :

Example 6 with ImageLinePanel

use of boofcv.gui.feature.ImageLinePanel in project BoofCV by lessthanoptimal.

the class ExampleLineDetection method detectLineSegments.

/**
 * Detects segments inside the image
 *
 * @param image Input image.
 * @param imageType Type of image processed by line detector.
 */
public static <T extends ImageGray<T>, D extends ImageGray<D>> void detectLineSegments(BufferedImage image, Class<T> imageType) {
    // convert the line into a single band image
    T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
    // Comment/uncomment to try a different type of line detector
    DetectLineSegment<T> detector = FactoryDetectLine.lineRansac(new ConfigLineRansac(40, 30, 2.36, true), imageType);
    List<LineSegment2D_F32> found = detector.detect(input);
    // display the results
    ImageLinePanel gui = new ImageLinePanel();
    gui.setImage(image);
    gui.setLineSegments(found);
    gui.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
    listPanel.addItem(gui, "Line Segments");
}
Also used : LineSegment2D_F32(georegression.struct.line.LineSegment2D_F32) ConfigLineRansac(boofcv.factory.feature.detect.line.ConfigLineRansac) ImageLinePanel(boofcv.gui.feature.ImageLinePanel)

Example 7 with ImageLinePanel

use of boofcv.gui.feature.ImageLinePanel in project BoofCV by lessthanoptimal.

the class ExampleLineDetection method detectLines.

private static <T extends ImageGray<T>> void detectLines(BufferedImage buffered, T gray, DetectLine<T> detector, String name) {
    List<LineParametric2D_F32> found = detector.detect(gray);
    // display the results
    ImageLinePanel gui = new ImageLinePanel();
    gui.setImage(buffered);
    gui.setLines(found);
    gui.setPreferredSize(new Dimension(gray.getWidth(), gray.getHeight()));
    listPanel.addItem(gui, name);
}
Also used : ImageLinePanel(boofcv.gui.feature.ImageLinePanel) LineParametric2D_F32(georegression.struct.line.LineParametric2D_F32)

Aggregations

ImageLinePanel (boofcv.gui.feature.ImageLinePanel)7 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 LineParametric2D_F32 (georegression.struct.line.LineParametric2D_F32)3 LineSegment2D_F32 (georegression.struct.line.LineSegment2D_F32)3 BufferedImage (java.awt.image.BufferedImage)3 ConfigHoughPolar (boofcv.factory.feature.detect.line.ConfigHoughPolar)2 Edgel (boofcv.alg.feature.detect.line.gridline.Edgel)1 GridLineModelDistance (boofcv.alg.feature.detect.line.gridline.GridLineModelDistance)1 GridLineModelFitter (boofcv.alg.feature.detect.line.gridline.GridLineModelFitter)1 ImplGridRansacLineDetector_F32 (boofcv.alg.feature.detect.line.gridline.ImplGridRansacLineDetector_F32)1 ConfigHoughFoot (boofcv.factory.feature.detect.line.ConfigHoughFoot)1 ConfigLineRansac (boofcv.factory.feature.detect.line.ConfigLineRansac)1 GrayF32 (boofcv.struct.image.GrayF32)1 GrayU8 (boofcv.struct.image.GrayU8)1 ModelManagerLinePolar2D_F32 (georegression.fitting.line.ModelManagerLinePolar2D_F32)1 LinePolar2D_F32 (georegression.struct.line.LinePolar2D_F32)1 Point2D_F64 (georegression.struct.point.Point2D_F64)1 Ransac (org.ddogleg.fitting.modelset.ransac.Ransac)1