Skip to content

Commit

Permalink
Fix bugs and add mean scielab metric
Browse files Browse the repository at this point in the history
  • Loading branch information
linusmossberg committed Mar 25, 2020
1 parent 3df4deb commit f9d0ba9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 73 deletions.
6 changes: 3 additions & 3 deletions source/circle-packing/findNumClusters.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

max_clusters = 16;

num_unique_colors = size(uniquetol(reshape(image, [], 3), 1e-3, 'ByRows', true), 1);
num_unique_colors = size(unique(reshape(im2uint8(image), [], 3), 'rows'), 1);

low_unique = false;
if num_unique_colors <= max_clusters
Expand All @@ -11,11 +11,11 @@
return;
end

num_colors = prod(size(image), 1:2);
num_colors = prod(size(image, 1:2));
max_colors = 256*256;

if(num_colors > max_colors)
image = imresize(image, sqrt(max_colors/num_colors), 'nearest');
image = imresize(image, sqrt(max_colors/num_colors), 'bilinear');
end

image = rgb2lab(image);
Expand Down
70 changes: 0 additions & 70 deletions source/lib/scielab/lab2xyz.m

This file was deleted.

10 changes: 10 additions & 0 deletions source/util/meanscielab.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function mean_scielab = meanscielab(reproduced, reference, distance, PPI)
D65_wp = [0.9504, 1.0000, 1.0888];
XYZ_reference = rgb2xyz(reference, 'WhitePoint', 'd65');
XYZ_reproduced = rgb2xyz(reproduced, 'WhitePoint', 'd65');
D = distance * 39.3700787;
SPD = PPI * D * tan(pi/180);
scielab_map = scielab(SPD, XYZ_reference, XYZ_reproduced, D65_wp, 'xyz');
mean_scielab = mean(scielab_map(:));
end

0 comments on commit f9d0ba9

Please sign in to comment.