This is the code I used, but it doesn't eliminate the blobs. I want to remove the obstacles only to determine the highest middle point for the robot to navigate.
rgb=imread('obstacle_scene_1.jpg'); figure, imshow(rgb); [im,map] = rgb2ind(rgb,5); figure, imshow(im,map) [X_no_dither,map]= rgb2ind(rgb,5,'nodither'); figure, imshow(X_no_dither,map); [im,map] = rgb2ind(rgb,5); figure, imshow(im,map) level = graythresh(X_no_dither); bw = im2bw(X_no_dither,level);bw = bwareaopen(bw, 50);figure, imshow(bw)
Best Answer