Upload Code
loading-left
loading loading loading
loading-right

Loading

Profile
No self-introduction
codes (1)
ColorHistogram
no vote
close all; clear all clc; I = imread('lavender.jpg'); imshow(I),figure I = im2double(I); [index,map] = rgb2ind(I); pixels = prod(size(index)); hsv = rgb2hsv(map); h = hsv(:,1); s = hsv(:,2); v = hsv(:,3); %Finds location of black and white pixels darks = find(v < .2)'; lights = find(s < .05 & v > .85)'; h([darks lights]) = -1; %Gets the number of all pixels for each color bin black = length(darks)/pixels; white = length(lights)/pixels; red = length(find((h > .9167 | h <= .083) & h ~= -1))/pixels; yellow = length(find(h > .083 & h <= .25))/pixels; green = length(find(h > .25 & h <= .4167))/pixels; cyan = length(find(h > .4167 & h <= .5833))/pixels; blue = length(find(h > .5833 & h <= .75))/pixels; magenta = length(find(h > .75 & h <= .9167))/pixels;<
lavanya487941
2016-08-23
0
1
No more~