필터 지우기
필터 지우기

How can a greyscale image be labeled?

조회 수: 2 (최근 30일)
Sheema Khattak
Sheema Khattak 2014년 4월 29일
댓글: Sheema Khattak 2014년 4월 30일
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
Image Analyst
Image Analyst 2014년 4월 29일
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
Sheema Khattak
Sheema Khattak 2014년 4월 30일
I need to label the segmented portions of image for identification.No not small one

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 29일
편집: Walter Roberson 2014년 4월 29일
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by