Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Is it possible to separate R portion, G portion, B portion of an RGB image?

2 visualizaciones (últimos 30 días)
Sivasurya J
Sivasurya J el 28 de Feb. de 2018
Cerrada: Jos (10584) el 1 de Mzo. de 2018
a = imread('eye.jpg');
imshow(a);title('H&E image');
text(size(a,2),size(a,1)+15,...
'Image Courtesy of Alen Partin,Johns Hopkins University',...
'FontSize',7,'HorizontalAlignment','right');
cform = makecform('srgb2lab');
lab_i = applycform(a,cform);
ab = double(lab_i(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
[cluster_idx,cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean',...
'Replicates',3);
pixel_labels = reshape(cluster_idx,nrows,ncols);
imshow(pixel_labels,[]),title('image labeled by clusterindex');
segmented_images = cell(1,3);
rgb_label = repmat(pixel_labels,[1 1 3]);
for k = 1:nColors
color = a;
color(rgb_label~=k) = 0;
segmented_images{k} = color;
end
imshow(segmented_images{1}),title('objects in cluster 1');
imshow(segmented_images{2}),title('objects in cluster 2');
If anyone knew some other program like this please post here..:)
  1 comentario
jonas
jonas el 1 de Mzo. de 2018
This is the third time I have seen you post this code in the last 24h. I suggest you read up on Imread and how images are described by pixels.

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by