public static < T extends ImageGray < T > , D extends ImageGray < D > > void detectLineSegments ( BufferedImage image , Class < T > imageType , Class < D > derivType ) { // 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 DetectLineSegmentsGridRansac < T , D > detector = FactoryDetectLineAlgs . lineRansac ( 40 , 30 , 2.36 , true , imageType , derivType ) ; 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 , "Found Line Segments" ) ; }
Detects segments inside the image