Separating particular pixels based on RGB value

조회 수: 1 (최근 30일)
Niranjan
Niranjan 2011년 3월 20일
I want to separate a group of pixels in an image which have RGB greater than [120 115 118 ] . How can I do it? The pixels having RGB values above the mentioned ones must appear in black color.How to do it? Thanks in advance.

채택된 답변

Walter Roberson
Walter Roberson 2011년 3월 20일
locations = YourImage(:,:,1) > 120 & YourImage(:,:,2) > 115 & YourImage(:,:,3) > 118;
YourImage(repmat(locations,1,1,3)) = 0;
  댓글 수: 3
Walter Roberson
Walter Roberson 2011년 3월 20일
Yes, that should work if you are using an old version of Matlab. Matlab has accepted the extended version for several years now.
Niranjan
Niranjan 2011년 3월 20일
oh thanks :)

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by