How to remove unwanted white region in frames

I have three frames of a video uploaded at: http://tinypic.com/view.php?pic=21dpojs&s=6 http://tinypic.com/view.php?pic=34oc0ea&s=6 and http://tinypic.com/view.php?pic=fuw00m&s=6 As clear from the figure uploaded;the first frame is clear having just the lanes. In second and third frame there is also some white region other than lanes. I want to remove that. I need to obtain the frames having only lanes not the smaller unwanted white region. Can anyone guide me of any general way that removes these type of unwanted white regions e.g I have used the command of bwareaopen(image,60) but its works for first frame but not for the rest.

 Accepted Answer

regionprops() and test the eccentricty; it will be quite different for the blobs than for the long white lines.

5 Comments

Sir I added the following lines in my code:
BWi = bwareaopen(I, 60);
[B,L]=bwboundaries(BWi,'noholes');
numRegions=max(L(:));
stats=regionprops(L,'all');
shapes=[stats.Eccentricity];
keepers=find(shapes>0.98);
figure,imshow(I)
for index=1:length(keepers)
outline=B{keepers(index)};
line(outline(:,2),outline(:,1),'color','r','LineWidth',2);
end
But the result is still the same. What should I do? guide me.
What range of values are you getting for eccentricity?
You could also consider filtering based on MajorAxis
Sir how can I do filtering based on MajorAxis. Your suggestion worked well for the starting frames but when I do my processing for remaining frames the results are not satisfactory. It detects those lines also which are not lanes how to avoid this false detection. Kindly guide me.
You can use thresholding and ismember() as shown in my Image Segmentation Tutorial.
got the solution thanx for your guidance :)

Sign in to comment.

More Answers (1)

You may have to measure of bunch of blobs for different things: eccentricity, circularity (perimeter^2/(4*pi*Area)), MajorAxisLength, Solidity, Area, etc. Then see which things, or combination of things accurately distinguish your lines. Then use ismember, like I do in my Image Segmentation Tutorial to filter out bad blobs and keep the ones you want. You might even need to compute the centroids and keep only those that are in some relation (like pairs on the nearby line numbers, or in certain parts of the image, though that would have to be adaptive to allow for your vehicle to change lanes and not lose the lane lines when it does so).
How do people in section 15.3.3.2 of Vision Bib do it? Have you read their papers on how they successfully did it? You're not breaking new ground here (at least not yet). You're far from the first person to do it so you might as well learn from them.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!