直线目标检测技术
2016-04-01 13:15
344 查看
Boofcv研究:直线目标检测
public class LineDetection { private static final float edgeThreshold = 25; private static final int maxLines = 10; private static ListDisplayPanel listPanel = new ListDisplayPanel(); public static<T extends ImageGray, D extends ImageGray> void detectLines( BufferedImage image , Class<T> imageType , Class<D> derivType ) { T input = ConvertBufferedImage.convertFromSingle(image, null, imageType ); DetectLineHoughPolar<T,D> detector = FactoryDetectLineAlgs.houghPolar( new ConfigHoughPolar(3, 30, 2, Math.PI / 180,edgeThreshold, maxLines), imageType, derivType); List<LineParametric2D_F32> found = detector.detect(input); ImageLinePanel gui = new ImageLinePanel(); gui.setBackground(image); gui.setLines(found); gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight())); listPanel.addItem(gui, "Found Lines"); } public static<T extends ImageGray, D extends ImageGray> void detectLineSegments( BufferedImage image , Class<T> imageType , Class<D> derivType ) { T input = ConvertBufferedImage.convertFromSingle(image, null, imageType ); DetectLineSegmentsGridRansac<T,D> detector = FactoryDetectLineAlgs.lineRansac(40, 30, 2.36, true, imageType, derivType); List<LineSegment2D_F32> found = detector.detect(input); ImageLinePanel gui = new ImageLinePanel(); gui.setBackground(image); gui.setLineSegments(found); gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight())); listPanel.addItem(gui, "Found Line Segments"); } public static void main( String args[] ) { BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("D:\\JavaProject\\Boofcv\\example\\simple_objects.jpg")); detectLines(input, GrayU8.class, GrayS16.class); detectLineSegments(input, GrayF32.class, GrayF32.class); ShowImages.showWindow(listPanel, "Detected Lines", true); } }
相关文章推荐
- Struts2上课视频
- java process communication
- (置顶)HDOJ题目分类
- 山东省第一届ACM省赛题——Greatest Number(不用dp的二分查找)
- 基数排序之java实现
- CSS盒子模型理解
- Android 联系人快速索引组件 QuickIndexView
- jQuery validate验证隐藏表单(hidden)域
- WiFi(网络)调试Android手机
- 斜杠、反斜杠以及换行符
- Java关键字static、final使用小结
- WPF-開發報表
- 调试断点进不去原因
- 叮咚小区官网新闻已不更新
- Zookeeper深入理解(五)Paxos算法
- 各类型液晶电视面板解析
- jquery 遮罩层指定位置
- 对人工智能中“极大极小值”的博弈算法的资料整理。
- Spring MVC系列(三)之获取参数
- QImage 转 osg::image方法