How can a greyscale image be labeled?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sheema Khattak
el 29 de Abr. de 2014
Comentada: Sheema Khattak
el 30 de Abr. de 2014
How can a greyscale image be labeled?
As bwlabel() works for labeling binary image how can we do the same for greyscale image in matlab
2 comentarios
Image Analyst
el 29 de Abr. de 2014
What's the use case? Why do you want this? What are you going to do with it? Can you give an example of the output you want for a small 7 by 7 image like this:
grayLevelImage =
1 1 2 4 5 5 1
5 4 1 3 2 1 5
3 2 1 3 2 1 4
5 1 1 3 3 1 4
2 3 4 1 4 1 1
3 1 2 3 3 4 5
4 1 3 5 2 3 5
Respuesta aceptada
Walter Roberson
el 29 de Abr. de 2014
Editada: Walter Roberson
el 29 de Abr. de 2014
labelled_image = zeros(size(YourImage),'uint16');
label_hw = 0;
max_grey = max(YourImage(:));
for K = 1 : max_grey
T = bwlabel(YourImage == K);
numlabel_here = max(T(:));
for L = 1 : numlabel_here
labelled_image(T == L) = label_hw + L;
end
label_hw = label_hw + numlabel_here;
end
At the end of this, labelled_image will be labelled such that each connected area that is all a single greyscale level will be considered to be a single class.
This is unlikely to be what you want: you probably want that "nearby" greyscale levels are merged together but that "edges" are recognized. That kind of separation is what segmenting is for.
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!