Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accuracy of mean_hue for Lab and Luv colors #505

Merged
merged 1 commit into from
Aug 5, 2021

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Jul 26, 2021

This calculates the bisection vector in Cartesian space and then obtains its angle.

This is still in the idea stage and has not been fully studied for accuracy and speed; I would like to prioritize the merging of PR #494.

Accuracy

1000000 samples mean error maximum error
Float32 before 6.4e-6 ° 4.0e-5 °
Float32 after 4.2e-6 ° 2.3e-5 °
Float64 before 12.0e-15 ° 7.7e-14 °
Float64 after 7.7e-15 ° 4.4e-14 °

Speed

Unfortunately, there is little speed improvement.

julia> a = Lab{Float32}.(rand(RGB{Float32}, 1000, 1000));

julia> b = Lab{Float32}.(rand(RGB{Float32}, 1000, 1000));

julia> @btime colordiff.($a, $b);
  69.342 ms (2 allocations: 3.81 MiB) # before
  67.334 ms (2 allocations: 3.81 MiB) # after

@codecov
Copy link

codecov bot commented Jul 26, 2021

Codecov Report

Merging #505 (5d7ece3) into master (f71d7a1) will increase coverage by 1.54%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #505      +/-   ##
==========================================
+ Coverage   93.84%   95.38%   +1.54%     
==========================================
  Files           9        9              
  Lines        1154     1171      +17     
==========================================
+ Hits         1083     1117      +34     
+ Misses         71       54      -17     
Impacted Files Coverage Δ
src/differences.jl 99.28% <100.00%> (-0.02%) ⬇️
src/utilities.jl 98.34% <100.00%> (-0.35%) ⬇️
src/conversions.jl 99.38% <0.00%> (+<0.01%) ⬆️
src/colormaps.jl 98.13% <0.00%> (+3.08%) ⬆️
src/algorithms.jl 75.00% <0.00%> (+14.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f71d7a1...5d7ece3. Read the comment docs.

@kimikage kimikage changed the title [WIP] Improve accuracy of mean_hue for Lab and Luv colors Improve accuracy of mean_hue for Lab and Luv colors Aug 5, 2021
@kimikage kimikage marked this pull request as ready for review August 5, 2021 12:41
This calculates the bisection vector in Cartesian space and then obtains its angle.
@kimikage kimikage merged commit 12549a8 into JuliaGraphics:master Aug 5, 2021
@kimikage kimikage deleted the mean_hue branch August 5, 2021 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant