4

Of course I know how to convert RGB to LAB and LAB to RGB, color difference calculation is mentioned at https://en.wikipedia.org/wiki/Color_difference.
However, it does not mention anything about opacity. I would like to know how to convert RGBA to LAB with semi-transparent, just including the opacity into the CIELAB ΔE* formula.

Original image
Original image

Image converted to 256 colors with formula abs(R1 - R2) + abs(G1 - G2) + abs(B1 - B2) + abs(alpha1 - alpha2) as fitting function to select palette and dithering
Image converted to 256 colors by RGB

Image converted to 256 colors with formula abs(L1 - L2) + abs(a1 - a2) + abs(b1 - b2) + abs(alpha1 - alpha2) as fitting function to select palette and dithering
Image converted to 256 colors by CIELab

Miller Cy Chan
  • 897
  • 9
  • 19
  • Colour difference is just about colours. Opacity is an orthogonal issue. Note: colour difference is defined for quality control. The number are valid if DeltaE < 5. Above 5 you cannot compare colours. A larger deltaE do not mean that colors are more different. For you, what do it mean 10% opacity difference? Equivalent to dark red to red? If you produce transparent object, you must measure both separately, and eventually you use a metric where 1 is the max error (both on colour and opacity). – Giacomo Catenazzi Dec 04 '18 at 14:15
  • Mäkinen, M.O.A. & Parkkinen, J & Jääskeläinen, Timo. (2005). Generalized opacity based on CIELAB colour coordinates and the CIE94 colour difference formula. Journal of Pulp and Paper Science. 31. 61-67. Opacity standards are based on a human vision model, but they take into account only lightness of the object. In this study, a new approach to estimate covering ability of papers is proposed. It was found that the CIE94 colour difference formula, which is based on CIELAB colour coordinates, is able to predict perceived covering ability of both white and coloured papers. – Miller Cy Chan Dec 05 '18 at 02:43
  • Note: opacity on paper is very different to "alpha" channel. And in general vision behave differently between paper and screen. But before going into details, could you explain what are you trying to measure with colour difference? [this will help also to find the right model of delta E] – Giacomo Catenazzi Dec 05 '18 at 06:42

2 Answers2

0

Composite the possibly-transparent image with a black background, then work with color differences.

-1

As CIELAB is a 3 dimensional color space, the formula should be square(CIE76) + square(alpha1 - alpha2) / exp(1.5) as fitting function to select palette. Then using RGBA color space to perform dithering.

More importantly, the alpha threshold should set to 15 to filter out the nearly transparent pixels.

enter image description here

"For dithering, even though it is the human visual system that is blending the colors of the adjacent pixels, we don’t just want a color space that models the perception of human eye – we want a color space that models the device!

Consider a yellow pixel above a blue pixel. The yellow pixel has the red and green elements fully lit, while the blue pixel has only the blue element. On the other hand, the midpoint between pure yellow and blue in CIELAB is a pale pinkish color."

Source: http://eastfarthing.com/blog/2017-09-23-dithering/

Miller Cy Chan
  • 897
  • 9
  • 19