Ask Your Question

Revision history [back]

Hi! I would do this in four steps:

  1. Extract connected component of text (using your binary mask)
  2. For each connected component, look for the surrounding class (i.e. object of interest or background)
  3. Paint each connected component in white or black, depending on the surrounding class...
  4. extract contour of the new binary mask

It's probably not the fastest way to do that, but it will probably work!