Quiz 8: Mixing RGB Colors

Home

Current Objective: Using Gamma Correction For Better Colors

Remember to follow each step and create the code as you go!!

You may have noticed the kinetic sculpture's colors seem saturated. On this page, we will modify the intensity of the LED in order to gamma correct for the perceived brightness by the human eye.

Read this guide on why we need gamma correction.


Gamma Correction

1. Before calling setColor, add a call to calculateGammaCorrection with the argument of rgbValue using the statement .


2. Add a new function header for Gamma Correction at the bottom of the sketch.


3. Open the definition of the function calculateGammaCorrection, which has a byte rgbArray[] parameter, with the statement .


4. Add a color for loop to the function definition of calculateGammaCorrection.


5. Declare a byte input and assign it to be the color element of rgbArray using the statement .


6. Declare a byte result and assign it to be the result of using readGammaTable on input using the statement .


7. Assign the color element of rgbValue to be the value of result using the statement .


8. Read the Quick Fix page of the resource linked above.


9. Implement theĀ Quick Fix by copying the gamma8 table, which opens with the statement .


10. Open the function definition of readGammaTable, which has a parameter byte input and returns a byte, with the statement .


11. Declare result as a byte variable and assign it to be the input element of the gamma8 table using the statement If you get stuck, check the resource.


12. Return the result using the statement


13. Observe
the differences when using theĀ gamma correction with your RGB colors.


Did you create all the code for this page? Before you click the next button, check you followed EACH question's instructions!!



Back Next Page