在位图中检测形状 [英] detecting shapes in a bitmap

查看:68
本文介绍了在位图中检测形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找一种好的算法来执行以下操作: 我有一个黑白图像,该图像仅包含多边形形状,这是通过在文档中进行扫描而得到的.我想在此图像中找到所有形状,对边缘进行平滑处理,最后获得平滑形状的坐标.有什么好的算法可以进行搜索和平滑处理,最终获得完美的形状?

looking for a good algorithm to do the following: I have a b&w image comprised solely of polygonal shapes, which i got by scanning in a document. I would like to find all the shapes in this image, smooth the edges, and in the end get the coordinates for the smooth shapes. Any good algorithms for doing the search and smoothing to get perfect shapes in the end?

推荐答案

我将从连接的组件标签开始,以分隔不同的多边形.

I would start with a connected component labeling in order to separate the different polygons.

一个简单的平滑方法是使用打开和关闭,但是如果多边形真的很薄,则可能会切掉它们.一种更复杂(但更好)的解决方案是将轮廓提取为参数函数(x(t),y(t))并使用一维高斯卷积对其进行平滑.

A simple solution for smoothing would be to use opening and a closing, but if the polygons are REALLY thin, it may cut them. A more complex (but better) solution, would be to extract the contour as a parametric function (x(t),y(t)) and to smooth it with a 1D gaussian convolution.

这篇关于在位图中检测形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆