フィルターのクリア

can any one tell me the meaning of the following lines

1 回表示 (過去 30 日間)
Anamika baruah
Anamika baruah 2014 年 6 月 15 日
回答済み: Image Analyst 2014 年 6 月 20 日
[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;
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])
  2 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 6 月 15 日
Luna - is there any line in particular that you are questioning or is it all of it? (I noticed that you have referenced this code in a couple of other questions today: question 1 and question 2.)
The best way to figure out what is happening is to step through the code and observe what is happening at each line.
dpb
dpb 2014 年 6 月 15 日
...best way to figure out what is happening is to step through the code and observe...
Preceded by or contemporaneous with reading the documentation for any functions you don't follow and using the examples for them in (generally) simpler conditions.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2014 年 6 月 20 日
It's counting the number of pixels with those particular colors.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by