Clear Filters
Clear Filters

How to extract an image?

3 views (last 30 days)
Darsana P M
Darsana P M on 20 Nov 2016
Commented: Image Analyst on 20 Nov 2016
The black region is the road and white region is the surrounding. I need to extract the black region alone and display the road. Can anybody help me with the matlab code?
[Edit by Image Analyst -- images inserted]

Answers (1)

Image Analyst
Image Analyst on 20 Nov 2016
We can't see your .fig files. Attach PNG format images with the green and brown frame icon. Until then, see my Image Segmentation tutorial or color segmentation tutorials: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Or else see the Color Thresholder on the Apps tab of the tool ribbon.
  2 Comments
Darsana P M
Darsana P M on 20 Nov 2016
i have made the image in png format
Image Analyst
Image Analyst on 20 Nov 2016
I did what I was hoping you'd do up top on your original post.
15.3.3 Road, Path Following Operators
15.3.3.1 Road Following, Depth, Stereo Based, Off-Road, Safe Path
15.3.3.2 Ground Plane Detection
15.3.3.3 Lane Detection, Lane Following, White Line Detection
15.3.3.4 Indoor Navigation Issues, Lines, Walls, Doors, Flat Surfaces
15.3.3.5 CMU Road Followers, ALVINN YARF MANIAC
15.3.3.6 Obstacle Dectection, Other Vehicles, Objects on the Road
15.3.3.6.1 Collision Avoidance, Collision Detection, Vehicles, Objects on the Road
15.3.3.6.2 Obstacles, Objects on the Road Using Radar, Sonar, Active Vision
15.3.3.7 Airplane Obstacles, Collision Detection, Sense and Avoid, Aircraft Landings
15.3.3.8 Road Signs, Traffic Signs, Traffic Lights, Objects along the Road, Inspections
To mask your image so that the road shows up in full RGB and elsewhere is blackened, starting with your binaryImage, you can do it like this:
mask = ~binaryImage; % Invert it so the road is white
% Mask the image using bsxfun() function
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!