1 | initial version |
You almost answered your question: dilating, then eroding is a suitable solution for fixing such continuity errors. If the rate of dilation, and erosion is same, the image information should remain, but incontinouitiy will be reduced.
Since you don't specyfy any platform, I assume c++. My example is super minimalistic, read the official tutorial for more details:
cv::Mat image_to_process;
//it will have a 3 pixel wide effect, since kernel is Mat(), see tutorial for more
cv::dilate(image_to_process, image_to_process, cv::Mat());
cv::erode(image_to_process, image_to_process, cv::Mat());
//done
Also simple median blur,or gaussian blur can help since the incontinuity can decsribed as high frequency noise, but it may suffer from other problems.