1 | initial version |
Hmm. Two suggestions to start with. First, draw the contours with -1 to fill the whole area. That will help with the spots inside the letters, or it should.
Second, most of your disconnects happen in the vertical direction. Try making a tall thin morphology operator and running that over the image doing a close operation. You can help keep it from messing up by segmenting the rows and doing each one individually. THIS post can help you with that.