need to extract the road segment part , but don't know which filter is good for removing the noise
1 view (last 30 days)
Show older comments
he=imread('r15.jpg'); figure, imshow(he);
if ndims(he)==3 I1=rgb2gray(he); else I1=double(he); end
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
ab = double(lab_he(:,:,2:3)); nrows = size(ab,1); ncols = size(ab,2); ab = reshape(ab,nrows*ncols,2);
nColors = 3; % repeat the clustering 3 times to avoid local minima [cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ... 'Replicates',3); pixel_labels = reshape(cluster_idx,nrows,ncols); figure,imshow(pixel_labels,[]), title('image labeled by cluster index');
segmented_images = cell(1,3); rgb_label = repmat(pixel_labels,[1 1 3]);
for k = 1:nColors color = he; color(rgb_label ~= k) = 0; segmented_images{k} = color;
end a= segmented_images{1}; c=rgb2gray(a); %I=imcomplement(a); %b = bwareaopen(c,10); figure,imshow(c), title('objects in cluster 1');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161592/image.jpeg)
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!