필터 지우기
필터 지우기

labelling image but getting error during overlay

조회 수: 1 (최근 30일)
Raza Ali
Raza Ali 2019년 9월 5일
답변: Obaid Rafiq Jan 2020년 11월 18일
I am labelling an image using MATLAB image labeler. But when i use labeloverlay commnad in MATLAB to map original and labeled image it gives error "Pixel label image has scalar pixel label IDs instead of RGB-triplet pixel label IDs". I can only understand that the labeled image is black and white and for overlaying command it needs RGB labeled image.
how to use these labeld images ? or how to resolve this error
  댓글 수: 4
Kritika Bansal
Kritika Bansal 2019년 9월 12일
Hi,
Can you also post the command that led to this error in MATLAB?
Raza Ali
Raza Ali 2019년 9월 13일
imageDir= fullfile('img');
labelDir= fullfile('PL');
classNames = ["A", "B"];
labelIDs = [0 0 0; 1 1 1];
imds = imageDatastore(imageDir);
pxds = pixelLabelDatastore(labelDir,classNames,labelIDs);
I = read(imds);
C = read(pxds);
Error using matlab.io.datastore.PixelLabelDatastore.label2cat (line 1033)
Pixel label image has scalar pixel label IDs instead of RGB-triplet pixel label IDs.

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

답변 (1개)

Obaid Rafiq Jan
Obaid Rafiq Jan 2020년 11월 18일
Hi Raza,
I was stuck on the same problem as you however, mine was the opposite. Instead you can try [0 1] which would make sense for a scalar quantity. The array that you defined for your pixel labels is an RGB triplet value which is what I should have done and it works for me. So if anyone else is having the same error as you, they just need to define each label's absolute scalar value as [x x] while if someone is having the opposite problem, they can try [x y z; x y z], where x y and z are the RGB absolute values.

Community Treasure Hunt

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

Start Hunting!

Translated by