¿Qué técnica de procesamiento de imágenes?

Is there an image processing algorithm that can fill these gaps within an image? The gaps are always lines and will run across the width of the image in all cases. The lines are mostly one-pixel thick.

Red lines indicate the gaps.

preguntado el 30 de junio de 12 a las 23:06

2 Respuestas

The ease of filling in these gaps depends on whether you're willing to tolerate some artifacts in other parts of the image. The easiest solutions are generally to use morphological operations.

If you want a quick and dirty approach, consider using cvMorphologyEx with an open operation using a rectangular structuring element that's 1 pixel wide and tall enough to cross the gaps you want to cover.

If this introduces unwanted artifacts, some additional background info would be helpful. For example, what's the maximum vertical gap? Are the unwanted black lines always exactly horizontal, or can the be vertical? Are they ever close to each other? What types of artifacts can you afford in other parts of the image?

Respondido el 30 de junio de 12 a las 23:06

Since you suggested opening I was thinking what size kernel I should use: to close 1 pixel gaps presumably a 2x2 pixel square kernel? - dr_rk

Since you only care about removing vertical gaps, the kernel only needs to be 1 pixel wide (and making it thinner will reduce the artifacts found on the edges). A 1x2 vertical kernel should do the trick (or 1x3 if OpenCV needs an odd number of elements). - Señor fooz

Image dilation accomplished by ANDing a matrix similar to the following: 111 000 111 should eliminate the problem. If all of the ANDs with image are TRUE, the result is TRUE as well (1/ WHITE) if not, FALSE (0/BLACK).

Respondido el 30 de junio de 12 a las 23:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.