Pramith Chathuranga
Pramith Chathuranga

Reputation: 524

How to remove black pixels inside the character image

I'm working with a project to recognize characters in the vehicle number plates using image processing and neural network in matlab. 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.enter image description here

Upvotes: 0

Views: 199

Answers (2)

Leander Moesinger
Leander Moesinger

Reputation: 2462

A more general solution which does not require to define the filter size:

BW2= imfill(BW,'holes') % fills holes

Where BW is a binary image (which I assume your image is). I'm not very familiar with licensing plates - if some of the characters contain closed spaces it will fill those up too.

Upvotes: 1

rhancock
rhancock

Reputation: 46

A very simple approach would be to apply an aggressive median filter to the image:

im = imread('image.png');
im = rgb2gray(im); %convert to grayscale
im_filtered = medfilt2(im, [10 10]); %filter

The filter size of [10 10] works with this particular image.

Upvotes: 3

Related Questions