How to extract an image?
1 次查看(过去 30 天)
显示 更早的评论
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]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158214/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158215/image.png)
0 个评论
回答(1 个)
Image Analyst
2016-11-20
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 个评论
Image Analyst
2016-11-20
I did what I was hoping you'd do up top on your original post.
You can find lane marker finding and road following papers here: http://www.visionbib.com/bibliography/contentsactive.html#Active%20Vision,%20Camera%20Calibration,%20Mobile%20Robots,%20Navigation,%20Road%20Following
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));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!