public static < T extends ImageGray < T > , D extends ImageGray < D > > void detectLines ( 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 DetectLineHoughPolar < T , D > detector = FactoryDetectLineAlgs . houghPolar ( new ConfigHoughPolar ( 3 , 30 , 2 , Math . PI / 180 , edgeThreshold , maxLines ) , imageType , derivType ) ; // DetectLineHoughFoot<T,D> detector = FactoryDetectLineAlgs.houghFoot( // new ConfigHoughFoot(3, 8, 5, edgeThreshold,maxLines), imageType, derivType); // DetectLineHoughFootSubimage<T,D> detector = FactoryDetectLineAlgs.houghFootSub( // new ConfigHoughFootSubimage(3, 8, 5, edgeThreshold,maxLines, 2, 2), imageType, derivType); List < LineParametric2D_F32 > found = detector . detect ( input ) ; // display the results ImageLinePanel gui = new ImageLinePanel ( ) ; gui . setImage ( image ) ; gui . setLines ( found ) ; gui . setPreferredSize ( new Dimension ( image . getWidth ( ) , image . getHeight ( ) ) ) ; listPanel . addItem ( gui , "Found Lines" ) ; }
Detects lines inside the image using different types of Hough detectors