# Demonstration of LAB color space

LAB color space has three channels: Lightness, Alpha, Beta. Alpha and Beta are coordinates to determine the color regardless of luminous. So one thing you can play with LAB is pickup objects in the image with the same color.

Figure 1.1 Atsuki's image, from left to right are original, with L=avg, with L=100.

An APL algorithm to convert RGB to LAB can be implemented as:

  |{
|     ⎕IO←1
|     d←⍉D65÷⍨⍤1⊢RGB2XYZ+.×⍤99 1⊢⍉⍵÷255
|     m←d>3*⍨6÷29
5 |     d←((~m)×(4÷29)+⍵÷3×2*⍨6÷29)+m×d*÷3
|     (⍴⍵)⍴(16-⍨116×2⌷d)⍪(500×(1⌷d)-2⌷d)⍪200×(2⌷d)-3⌷d
|  }


Where RGB2XYZ is the matrix $\left[\begin{array}{ccc}0.49& 0.31& 0.2\\ 0.17697& 0.8124& 0.01063\\ 0& 0.01& 0.99\end{array}\right]$.

Use some imagination, you may already know how to implement magic wand selector with these information.