Detecting a small curve
Suppose you have a contour made of lines, arcs, etc. It can be of any size from 1e-6 to 1e+6. How can I detect tiny useless curves inside it? At the moment we are taking the diagonal of the contour bounding rect * 1e-9 and for very distorted contours (where width is for example many times bigger of the height) it fails.
Does开发者_Python百科 any scentific approach exist to eliminate this tiny useless curves?
Thanks.
By the phrasing of your question I assume your problem is using floating point for geometry. It is a common mistake. Use integers instead and it will become very clear at what point a curve is really a line. Or when two points are equal. You need to normalize all your data and work with a fixed precision from there.
精彩评论