2019-11-07 16:36:30 +00:00
|
|
|
function F=extractGlobalColHist(img)
|
|
|
|
|
2019-11-08 11:51:33 +00:00
|
|
|
divs = 15;
|
2019-11-07 16:36:30 +00:00
|
|
|
|
2019-11-08 11:51:33 +00:00
|
|
|
qimg = floor(img .* divs);
|
|
|
|
bin = qimg(:,:,1) * divs^2 + qimg(:,:,2) * divs^1 + qimg(:,:,3);
|
2019-11-07 16:36:30 +00:00
|
|
|
|
2019-11-08 11:51:33 +00:00
|
|
|
vals = reshape(bin, 1, size(bin, 1) * size(bin, 2));
|
2019-11-07 16:36:30 +00:00
|
|
|
|
2019-11-08 11:51:33 +00:00
|
|
|
% dimensions = size(img);
|
|
|
|
%
|
|
|
|
% width = dimensions(2);
|
|
|
|
% height = dimensions(1);
|
|
|
|
%
|
|
|
|
% pixel_count = width * height;
|
|
|
|
%
|
|
|
|
% bin_values = zeros([1, pixel_count]);
|
|
|
|
% count = 1;
|
|
|
|
% for i = 1:length(img(:, 1, 1))
|
|
|
|
% for j = 1:length(img(1, :, 1))
|
|
|
|
% red = img(i, j, 1);
|
|
|
|
% green = img(i, j, 2);
|
|
|
|
% blue = img(i, j, 3);
|
|
|
|
%
|
|
|
|
% red_bin = floor(red*divs);
|
|
|
|
% green_bin = floor(green*divs);
|
|
|
|
% blue_bin = floor(blue*divs);
|
|
|
|
%
|
|
|
|
% bin_value = red_bin * (divs^2) + green_bin * (divs^1) + blue_bin;
|
|
|
|
%
|
|
|
|
% bin_values(count) = bin_value;
|
|
|
|
%
|
|
|
|
% count = count + 1;
|
|
|
|
% end
|
|
|
|
% end
|
2019-11-07 16:36:30 +00:00
|
|
|
|
|
|
|
% hist_values = histogram(bin_values, (divs^3 - 1)).Values ./ pixel_count;
|
2019-11-08 11:51:33 +00:00
|
|
|
% hist_values = histogram(bin_values, divs^3, 'Normalization', 'probability').Values;
|
|
|
|
|
|
|
|
hist_values = histogram(vals, divs^3, 'Normalization', 'probability').Values;
|
2019-11-07 16:36:30 +00:00
|
|
|
|
|
|
|
F=hist_values;
|
|
|
|
return;
|