MATLAB: How to remove the black pixels inside the character

computer visionimage processingMATLAB

I'm working with a project to recognize characters in the vehicle number plates using image processing and neural network. I Have extracted features like endpoints etc. My problem is when skelenizing the image there are some pixels remain inside the character(image1), hence I don't get a smooth skeletonized image as I want which is a thinned image . Can someone can help me to remove these black pixels inside the character.

Best Answer

Use imfill():
binaryImage = imfill(binaryImage, 'holes');