need to extract the road segment part , but don't know which filter is good for removing the noise
1 回表示 (過去 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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161592/image.jpeg)
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!