Skip to content

Conversation

@DiegoPino
Copy link
Member

See #1

Not yet ready. Because this is math, I will add some tests + an example usage based on k-means clustering (with both per sample weights and per feature (means weighted vectors) too.

This code is based on php-ml code with some updates and architecture changes (e.g during clustering, each cluster will be a VectorSpace Object too + weight addition to vector)

I might refactor distance metric implementations into its own class with static methods *or not

@DiegoPino DiegoPino self-assigned this Jan 14, 2026
@DiegoPino DiegoPino added the enhancement New feature or request label Jan 14, 2026
…(only J,a,b for euclidean distance) static maps/files

Original file is from https://github.com/jonathantneal/color-names/blob/master/color-names.json
The cam16_ucs version will be used to allow an extra option -> naming/snapping extracted colors to a vocab. I will also allow a user to pass a structure if the complete set is just too extensive (useful for faceting, building web palettes)
TODO: allow a composer level script to be used to regenerate this every time we change the original one and document it
Note: cam16_ucs is based here on D65 whitepoint. Important if you are trying to "snap" ...
extends SplObjectStorage, using the extra data to keep track of frequency.
…in XYZ is annoying

Updates the gamma correction values. The cam16ucsToCam16 is not ready (like actually wrong), also brings a lot of the weird setup math to ::cam16Helpers
All internal XYZ functions work on 1/100 so need to adapt.
Also, i am assuming only [J][M][h] are passed to cam16toXYZ. I might want to implement when C or s are available.
…t a centroid after clustering with a new color not present in palette)

Round trip HEX TO CAM16UCS and Back works perfectly. Some operations have too many floating point elements so i rounded on the cam16ucs to RGB back a bit
@alliomeria just a tag so you know this was added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants