I have written a code to calculate color histogram of an color image..but i donot the meaning of each and every line.can anyone tell me the meaning of each line??

1 visualizzazione (ultimi 30 giorni)
[index, map]=rgb2ind(I,65300); pixels= prod(size(index)); hsv=rgb2hsv(map); h = hsv(:,1); s = hsv(:,2); v = hsv(:,3); darks = find(v <.2)'; lights = find(s < .05 & v > .85)'; h([darks lights])= -1; disp(length(darks)) 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; disp('Red=') disp(red) disp('Blue=') disp(blue) a(i,1)=red a(i,2)=green a(i,3)=blue a(i,4)=yellow a(i,5)=cyan a(i,6)=magenta a(i,7)=black a(i,8)=white end dlmwrite('fr.mat',a) b=dlmread('fr.mat') hold on fill([0 0 1 1], [0 red red 0], 'r') fill([1 1 2 2],[0 yellow yellow 0], 'y') fill([2 2 3 3],[0 green green 0], 'g') fill([3 3 4 4],[0 cyan cyan 0], 'c') fill([4 4 5 5],[0 blue blue 0], 'b') fill([5 5 6 6],[0 magenta magenta 0], 'm') fill([6 6 7 7],[0 white white 0], 'w') fill([7 7 8 8],[0 black black 0], 'k') axis([0 8 0 1])

Risposta accettata

Image Analyst
Image Analyst il 14 Giu 2014
But it looks like it's trying to classify an image into verious color classes and get the area fractions (in a very inefficient way) of each color class.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by