image processing - OpenCV - How to remove small line segments from contour? -


Is there any way to remove sections of a small line from a contour?

For example, in this image, the largest contour is specified in green and the result is blue:

 Enter image description here

There is a set of contour digit, I think we are in red circle to remove those homogeneous sections Can do something for you. For example, to detect and remove small lines or small sub-shapes or in some other way. But I do not know how I can do this.

Please remember that I want to remove them after finding contour and not before. Do you know how can I remove them? Or any thoughts?

I have found that the contour area is good for removing small, separate configurations. This snippet shows how you can proceed:

  findContours (edges, shapes, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);   

...

  // love shape vector & lt; Vector & lt; Point & gt; & Gt; PrunedContours; (Size I}} If the "loops" or the outer contour areas are part of the larger contour of interest, take a look. It is possible that the rough estimate of your original contour is the external characteristics .   

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -