Luminance is a characteristic of emission or reflection of the flat surface. In digital photography and computer science, relative luminance is used to specify the relative brightness of the coloured surface. Relative luminance is normalised for a value between 0 (black) and 1 (white), and is calculated as 0.2126 x R + 0.7152 x G + 0.0722 x B. The values "R," "G" and "B" are nonlinear components of the RGB (Red/Green/Blue) colour code that can be computed from the standard digital RGB counts.

Navigate to the RGB Color Table using the link in resources and find digital RGB components for the colour of an object. For example, RGB for the purple colour are 155, 48 and 255.

Divide the first component from Step 1 by 255. In our example, it is 155 / 255 = 0.6078.

If the value from Step 2 is less or equal 0.03928, divide it by 12.92 to calculate "R" nonlinear component. If the value from Step 2 is greater than 0.03928, add 0.055 to it and divide the sum by 1.055. Finally raise the quotient in the power 2.4 to calculate "R." In our example, 0.6078 is larger than 0.03928, hence the second case is applied. R = ((0.6078 + 0.055) / 1.055)^2.4 = 0.3277.

Multiply the value "R" from Step 3 by 0.2126. In our example, it is 0.3277 x 0.2126 = 0.07.

Divide the second component from Step 1 by 255. In our example, it is 48 / 255 = 0.1882.

If the value from Step 5 is less than or equal to 0.03928, divide it by 12.92 to calculate "G" nonlinear component. If the value from Step 5 is greater than 0.03928, add 0.055 to it and divide the sum by 1.055. Finally, raise the quotient in the power 2.4 to calculate "G." In our example, 0.1882 is less than 0.03928, hence the first case is applied. G = 0.1882 / 12.92 = 0.0146.

Multiply the value "G" from Step 6 by 0.7152. In our example, it is 0.0146 x 0.7152 = 0.01.

Divide the third component from Step 1 by 255. In our example, it is 255 / 255 = 1.

If the value from Step 8 is less than or equal to 0.03928, divide it by 12.92 to calculate "B" nonlinear component. If the value from Step 8 is greater than 0.03928, add 0.055 to it and divide the sum by 1.055. Finally raise the quotient in the power 2.4 to calculate "B." In our example, 1 is greater than 0.03928, hence the second case is applied. B = (1 + 0.055) / 1.055)^2.4 = 1.

Multiply the value "B" from Step 9 by 0.0722. In our example, it is 1 x 0.0722 = 0.0722.

Add up values from Steps 4, 7 and 10 to calculate relative luminance. In our example, luminance = 0.07 + 0.01 + 0.0722 = 0.1522.