2

The spatial resolution images that i will be using in this project is 1000x563. My aim in this step is to remove all unwanted white pixel but not the number plate so I could segment the plate accurately. But the problem is I could not remove those unwanted pixels clearly. Can anybody help me to improve the codes?

From: enter image description here Then, enter image description here Then, enter image description here Lastly, enter image description here

As you observed the last image, there are still quite a number of unwanted white pixels. Please help !!

ab=imread('image4.jpg');
ab=rgb2gray(ab);
level=graythresh(ab);
 ab=im2bw(ab,level);

ab=medfilt2(ab,[3 3]);


ab=edge(ab,'Canny');
figure(); imshow(ab);

Tmp = imfill(ab, 'holes'); %flood filling techniques
Tmp2 = imfill(Tmp-ab, 'holes'); 
Res = Tmp - imfill(ab & Tmp2, 'holes');
figure(); imshow(Res,[]); 


% keeping the white pixels area between 200 to 1000
LB = 200;        
UB = 1000;
Res = xor(bwareaopen(Res,LB),  bwareaopen(Res,UB));
figure, imshow(Res,[]);


se = strel('disk',2);        
Res = imerode(Res,se);
Res=imdilate(Res,se);


Res = bwareaopen(Res, 200);

figure();
imshow(Res,[]);
Wong Wengkeong
  • 181
  • 1
  • 14

2 Answers2

4

You might want to consider using Stroke Width Transform. A Matlab implementation can be found here. This transform is used to detect text in natural images. It is designed to work in a much more challenging settings than yours. So, I guess you should give it a try.

Community
  • 1
  • 1
Shai
  • 111,146
  • 38
  • 238
  • 371
  • you wrote down an algorithm in http://stackoverflow.com/questions/19960826/how-to-make-the-blackboard-text-appear-clearer-using-matlab can you briefly tell me how to apply the function, for instance, parameter "dol".. swt and swtcc. Much appreciated, sir. – Wong Wengkeong Apr 17 '15 at 11:03
0

Is the number plate in your pictures always the same size (at least approximately)?
If so you could look at some fix-sized patch of pixels, maybe with some overlap to others, and if the number of white pixels is above some threshold leave them and otherwise paint them black.
Or just mark them and if the surrounding patches are also to be cleaned, paint them black.

wiseveri
  • 191
  • 1
  • 9