Binary Image

This is a binary image. I want to remove the portion in the red region, and keep the one in the green region.

The red region has the property of double parallel edges, whereas green does not. If someone could suggest an algorithm it would be helpful.

  • $\begingroup$ Its not clear what your asking. Are you looking for a way to remove pixels from an already defined area, or are you looking for an algorithm for defining the area? $\endgroup$ – slayton Oct 19 '12 at 16:23
  • $\begingroup$ @slayton no I am talking about the whole image. I want to detect the parallel edges(the type inside red region). and set them to black $\endgroup$ – crack_addict Oct 19 '12 at 16:35
  • $\begingroup$ The problem that the "lines" are not really "parallel", first they are curved lines and are only approximately parallel to one another. $\endgroup$ – bla Oct 19 '12 at 16:47
  • 1
    $\begingroup$ @nate - yes I have to implement this to other images also, but if something works on this, it will work on others also. I was trying something on moving a small kernel and finding lines based on hough transform. $\endgroup$ – crack_addict Oct 19 '12 at 16:56
  • 1
    $\begingroup$ @crack_addict I think you are one step too far in the pipeline, this might be able to be done better before thresholding. There looks like there are many double lines in the image, but with gaps due to the thresholding. IMO thresholding is towards the end of the pipeline. Can you post the image before this step? $\endgroup$ – geometrikal Oct 22 '12 at 1:12

Just a suggestion:

  1. perform binary skeletonization
  2. detect lines as connected sets of pixels
  3. for every line, find distance to nearest pixel on some other line
  4. compute average distance between inspected line and the nearest line
  5. if the computed distance lays within some predefined interval (say, 3-8 pixels), consider it a double-line and remove both lines

The interval can be determined statistically because double lines have distances forming a distribution, which can be separated well from other line distances in the image.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.