Switch thread color distance from HSV to dE-2000 (perceptually accurate) #79
Labels
No labels
blocked:children
blocked:depends-101
blocked:depends-103
blocked:depends-104
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:preflight
bug
chore
feature-request
in-progress
lint-cleanup
needs-decompose
performance
quality
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch#79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
src/embroidery_converter/thread_manager.pyuses HSV distance for thread matching:find_closest_colordelegates to_color_distance_hsv. HSV is not perceptually uniform — equal numerical distances in HSV don't correspond to equal perceived color differences. This produces thread matches that look wrong to human eyes (a "good" HSV match can be visually distant).Goal
Switch the distance metric to ΔE-2000 (CIEDE2000), which is the standard for perceptually accurate color difference.
Why ΔE-2000
Implementation
_color_distance_delta_e_2000(rgb1, rgb2)helper that computes CIEDE2000 distance.scikit-image(already a dependency).scikit-image.color.deltaE_ciede2000works directly.distance_metricparameter toThreadMatcher.__init__(default"delta_e_2000", allow"hsv"for back-compat)._color_distance_hsvcalls with_color_distance_delta_e_2000when the new metric is selected.tolerance=5.0(ΔE),tolerance=50.0(HSV).Acceptance
ThreadMatcher().match_color("#aabbcc")returns a match where the ΔE distance is below 5 (perceptually close).Blocks
Mark/easystitch-service#1—/v1/threads/resolveresponse shape requiresdeltaE: floatper match.Notes