问题
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?
回答1:
I would start with a connected component labeling in order to separate the different polygons.
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.
来源:https://stackoverflow.com/questions/12903232/detecting-shapes-in-a-bitmap