Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove small parallel line in image?

I have black and white image after binarization. After that I have image like below:

http://ifotos.pl/zobacz/ipng_xhnxhrh.png/

How can I remove the small lines parallel to the long curves using OpenCV?. I can remove them by removing all small objects, but I want to remove only the small parallel lines.

like image 851
user1666649 Avatar asked Nov 30 '25 09:11

user1666649


1 Answers

This looks like a Canny artifact (or some kind of ringing artifact) to me. There are several ways to remove them.

An empiric but not too computing intensive method would be to locate all small features, and superimpose them with the same image shifted by [+/-]X, [+/-]Y. If the feature is completely coincident with the shifted image, i.e., all pixels in the white feature are also white in the shifted image, then you are probably looking at an artifact.

To evaluate "smallness" of feature, you can use a basic floodfill. This method is cheap because you can simulate shifting with pointers, without really allocating four shifted images. It is prone to false positives wherever you really have small parallel lines, and to false negatives if the artifacts are very large.

Another method would be to posterize twice the original image with different thresholds. While the "real" lines will stay together, the ringing artifacts will have a different strength. At that point you evaluate the image difference, and consider "artifact" all features that are farther than a given threshold from the image track. This is a bit more computation intensive, yields better results, but depends on what you have for an original image, i.e. what is your workflow.

It is possible that reevaluating the workflow (altering the edge detection phase) could avoid the creation of the artifacts altogether.

like image 109
LSerni Avatar answered Dec 02 '25 23:12

LSerni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!