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:
Then,
Then,
Lastly, 
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,[]);