Normalizing pixel colours of an RGB image

조회 수: 10 (최근 30일)
Riccardo Rossi
Riccardo Rossi 2023년 5월 27일
댓글: Image Analyst 2023년 5월 27일
Hello,
I need to normalize an RGB image by replacing each channel (RED, GREEN and BLUE) of each pixel with the following values:
RED=RED/(RED+GREEN+BLUE)
GREEN=GREEN/(RED+GREEN+BLUE)
BLUE=BLUE/(RED+GREEN+BLUE)
How can I do it? Thank you so much!
  댓글 수: 3
Riccardo Rossi
Riccardo Rossi 2023년 5월 27일
Hi, I am reading the image into Matlab as a 3888x2592x3 uint8.
Image Analyst
Image Analyst 2023년 5월 27일
If that Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

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

채택된 답변

DGM
DGM 2023년 5월 27일
inpict = imread('peppers.png'); % uint8
inpict = im2double(inpict); % unit-scale float
outpict = inpict./sum(inpict,3); % all at once
imshow(outpict) % done

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by