How to remove everything that is grey (127, 127, 127) from an image?

조회 수: 1 (최근 30일)
Hi,
I want to remove everything with the rgb color (127, 127, 127) from an image. I am using
externalMask = planta.img(:,:,1)==127 & planta.img(:,:,2)==127 &...
planta.img(:,:,3)==127
to know where the grey pixels are.
I want to show the image and that the grey parts doesn't appear.
How can I do that?
Thanks in advance!
PS: I am using R2016a version.

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 29일
편집: Walter Roberson 2020년 12월 29일
mask = all(planta.img == 127, 3);
image(planta.img, 'AlphaData', 1-mask)
  댓글 수: 5
Image Analyst
Image Analyst 2020년 12월 29일
Need double equals:
mask = all(planta.img == 127, 3);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by