image.rgb2lab
result = image.rgb2lab(img)
Input: img · Output: result
What it is
img is an Image. Per-pixel sRGB→CIE L\*a\*b\* conversion (D65 white point), the whole-Image counterpart to the scalar to_lab, reusing its exact conversion math.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = image.rgb2lab(img) | img Image or scalarnot documented yet | l —0–100b —roughly -128..127 | Returns a Record with fields l (0–100), a, b (roughly -128..127), each a Mat the same shape as img. Added in v0.4.0. |
Examples
No documentation example calls this form yet. The Images chapter is where one belongs.
How it works
rgb2hsv(img) / rgb2lab(img) -- per-pixel colorspace conversion, the whole-Image counterpart to the existing scalar to_hsv/to_lab (a single color's coordinates). Reuse color::rgb_to_hsv/rgb_to_lab exactly (no separate per-pixel math to drift out of sync with the scalar builtins), called once per pixel. Returns a Record of three same-shape Mats (h/s/v or l/a/b) rather than a Value::Image -- hue is 0-360 and Lab's a*/b* run roughly -128..127, neither of which an 8-bit RGB Image can hold without truncating, and this codebase's Image type has no space tag to mark it "not really RGB" (a known, deliberately deferred gap -- see qu_image's own module doc comment). image::hsv2rgb/ image::lab2rgb above accept exactly this shape back.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.