Matlab Diary for HW1
colorbar
colorbar =
1 1 0 0 0 1 1 0
0 1 1 1 0 0 1 0
0 0 0 1 1 1 1 0
UsVsWs = colorconv(colorbar)
UsVsWs =
Columns 1 through 7
258.4376 -8.0521 -132.2679 -97.6266 3.3798 138.6469 -0.0000
13.6608 80.7580 86.9952 -5.1605 -33.8969 -91.1908 -0.0000
48.1525 98.6516 91.3021 91.7884 8.8070 49.4751 99.0784
Column 8
46.4896
69.8042
-17.0000
D = distances(UsVsWs)
D =
Columns 1 through 7
0 279.4083 399.8633 359.2215 262.4201 159.2025 263.7614
0 0 124.5892 124.3088 146.1112 231.3122 81.1596
0 0 0 98.4526 199.5510 326.9473 158.5037
0 0 0 0 133.8431 254.9839 98.0343
0 0 0 0 0 152.4260 96.4849
0 0 0 0 0 0 173.2028
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Column 8
228.7332
128.3358
209.7120
195.5098
115.2318
197.0565
143.2065
0
max(max(D))
ans =
399.8633
% from this we see that the largest distance (399.8633) is between colors
% 1 and 3 (red and green)
sort(D)
ans =
Columns 1 through 7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 81.1596
0 0 0 0 0 152.4260 96.4849
0 0 0 0 133.8431 159.2025 98.0343
0 0 0 98.4526 146.1112 231.3122 158.5037
0 0 124.5892 124.3088 199.5510 254.9839 173.2028
0 279.4083 399.8633 359.2215 262.4201 326.9473 263.7614
Column 8
0
115.2318
128.3358
143.2065
195.5098
197.0565
209.7120
228.7332
% from here we see that the smallest distance is 81.1596, which is between colors
% 2 and 7 (yellow and white).
testbar
testbar =
0.5255 0.3333 0.8000 0.5255 0.7137 0.8000
0.7843 0.0510 0 0.4667 0.0510 0.6588
0.2863 0.4824 0.4235 0.2863 0.4824 0.4235
UsVsWs = colorconv(testbar)
UsVsWs =
-35.2822 61.1095 157.8094 6.6296 124.5605 14.5434
43.4271 -60.7316 -53.0610 20.6011 -52.4792 21.9788
87.6648 37.8745 44.1384 73.5751 47.6682 85.1354
D = distances(UsVsWs)
D =
0 150.3977 220.2019 49.7609 190.6500 54.3049
0 0 97.2056 104.1998 64.7305 106.0330
0 0 0 170.7277 33.4408 166.8438
0 0 0 0 141.1368 14.0773
0 0 0 0 0 138.0273
0 0 0 0 0 0
max(max(D))
ans =
220.2019
% so for the test colors, the most dissimilar are 1 and 3 (again a
% greenish and a reddish.
sort(D)
ans =
0 0 0 0 0 0
0 0 0 0 0 14.0773
0 0 0 0 33.4408 54.3049
0 0 0 49.7609 64.7305 106.0330
0 0 97.2056 104.1998 141.1368 138.0273
0 150.3977 220.2019 170.7277 190.6500 166.8438
% and the most similar colors are for 4 and 6 (distance = 14), which are the two tannish/brownish
% colors. The two reds, which I would have thought to be most similar, are slightly
% farther apart in U*V*W* space, a distance of 33.
Back