感兴趣区域检测技术

来源:互联网 发布:java agent 做监控 编辑:程序博客网 时间:2024/06/06 14:59

Boofcv研究:感兴趣区域检测技术

public class InterestPoint {    public static <T extends ImageGray>    void detect( BufferedImage image , Class<T> imageType ) {        T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);        InterestPointDetector<T> detector = FactoryInterestPoint.fastHessian(                new ConfigFastHessian(10, 2, 100, 2, 9, 3, 4));        detector.detect(input);        displayResults(image, detector);    }    private static <T extends ImageGray>    void displayResults(BufferedImage image, InterestPointDetector<T> detector)    {        Graphics2D g2 = image.createGraphics();        FancyInterestPointRender render = new FancyInterestPointRender();        for( int i = 0; i < detector.getNumberOfFeatures(); i++ ) {            Point2D_F64 pt = detector.getLocation(i);            if( detector.hasScale() ) {                int radius = (int)(detector.getRadius(i));                render.addCircle((int)pt.x,(int)pt.y,radius);            } else {                render.addPoint((int) pt.x, (int) pt.y);            }        }        g2.setStroke(new BasicStroke(3));        render.draw(g2);        ShowImages.showWindow(image, "Detected Features", true);    }    public static void main( String args[] ) {        BufferedImage image = UtilImageIO.loadImage(UtilIO.pathExample("D:\\JavaProject\\Boofcv\\example\\sunflowers.jpg"));        detect(image, GrayF32.class);    }}

这里写图片描述

0 0
原创粉丝点击