need to extract the road segment part , but don't know which filter is good for removing the noise

2 次查看(过去 30 天)
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');

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cluster Analysis and Anomaly Detection 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by