How can I perform arithmetic operations with RGB values?

Technical Source
2 min readJan 13, 2022

--

I have an image, and I want to get values of a parameter for each pixel of the image. The parameter is a function of the RGB values of the image. In order to evaluate the parameter, I need to perform basic arithmetic operations involving RGB values, but I am not able to to that as RGB values are scaled ones. e.g., if R=243, and I want to add 30 with it, the answer becomes 255 instead of 273, as that is the maximum permissible limit for the pixel intensity values. What I understand is that I cannot treat RGB values as general numeric entities. Any help regarding converting them into numerical values so that arithmetic operations can be performed is highly appreciated.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

“What I understand is that I cannot treat RGB values as general numeric entities.”

Yes you can. The fact that your data are RGB is totally irrelevant. The problems you are having have nothing to do with RGB per se, just the numeric type that they happen to be stored in, which happens to be uint8 (with a maximum value of 255):

You can check the class of those RGB values by calling class:

class(X)

for your data X. Then take a look at this example, which shows that what you are observing has nothing to do with the fact that you data are RGB values:

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet