replace RGB values with new values

조회 수: 1(최근 30일)
Elysi Cochin
Elysi Cochin 2022년 5월 25일
편집: Elysi Cochin 2022년 5월 25일
How to change the pixel values of a RGB image to
% if pixel value is in the following range
0-64 to 0
65-128 to 1
129-192 to 2
192-255 to 3
How to change in all the channels without using for loop

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 5월 25일
편집: Dyuman Joshi 2022년 5월 25일
rgb=[67,68,69;0,67,69;0,66,68;125,126,127;122,125,127;117,122,126;113,114,115;110,113,115;106,111,114]
rgb = 9×3
67 68 69 0 67 69 0 66 68 125 126 127 122 125 127 117 122 126 113 114 115 110 113 115 106 111 114
floor(abs(rgb-1)/64)
ans = 9×3
1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  댓글 수: 2
Elysi Cochin
Elysi Cochin 2022년 5월 25일
편집: Elysi Cochin 2022년 5월 25일
Thank you both of you. For uint8 @DGM comment should be considered.

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

추가 답변(0개)

범주

Find more on Images in Help Center and File Exchange

태그

Community Treasure Hunt

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

Start Hunting!

Translated by