Kohulan / DECIMER-Image-Segmentation

Chemical structure detection and segmentation tool for Journal articles.
https://decimer.ai
MIT License
81 stars 30 forks source link

Horizontal vertical line exclusion #77

Closed OBrink closed 1 year ago

OBrink commented 1 year ago

In order to make the mask expansion a bit more "intelligent" and to avoid that it includes complete tables, I have implemented a very straightforward algorithm: 1) Detect vertical and horizontal lines, that have a length of >= 20% of the image height/width in the dilated image and create a binary mask ("exclusion mask") to label the pixels that belong to these lines. 2) During the mask expansion: Whenever a pixel is in question to be treated as a new seed pixel: Check if it is labelled in the exclusion mask. 2a) If labelled in the exclusion mask, do not consider it a new seed pixel. 2b) If not labelled in the exclusion mask: Proceed as usual (add it to the seed pixel list)

This is simple, fast and effective to avoid whole tables being included in the masks because they touch a chemical structure depiction in the dilated image.