Image contrast when using labeloverlay

조회 수: 4 (최근 30일)
Matt K.
Matt K. 2022년 3월 7일
댓글: DGM 2022년 3월 10일
Hi,
I have setup an image datastore and a pixel label datastore for some semantic image segmentation I'd like to do and I used some code in an example to show some overlays from some images within my image/pixel lists:
for i=81:85
im=readimage(imds,i);
C=readimage(pxds,i);
B=labeloverlay(im,C,'transparency',0.5);
figure,imshow(B);
end
However, when I do this, I find that the display range for the image is too wide:
Is there a way to change display range of the background image? It's an int16 image with a [min max] range of [0 4741]
Thanks for your help,
Matt

채택된 답변

DGM
DGM 2022년 3월 7일
편집: DGM 2022년 3월 7일
Try putting your images on a common scale.
im = mat2gray(im);
C = mat2gray(C);
This will put both images in the range [0 1].
  댓글 수: 2
Matt K.
Matt K. 2022년 3월 10일
Thanks! That did the trick.
I see that the image was rescaled to [0,1], but I'm not sure how this worked as C is a categorical matrix (?)
In any case, it now looks the way that it should look:
(a different slice than in the original question)
DGM
DGM 2022년 3월 10일
I ... really don't know what to say about the categorical array part. I almost never use categoricals for anything, and I never use datastore stuff so I'm not sure what to expect. At least it seems to be working.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by