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. 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
.
Use some imagination, you may already know how to implement magic wand selector with these information.