フィルターのクリア

How to compute histograms of 10 bins and to use only its last 5 bins?

1 回表示 (過去 30 日間)
Jyothis Jose
Jyothis Jose 2014 年 5 月 4 日
コメント済み: Image Analyst 2014 年 5 月 4 日
I need to compute histogram of 10 bins of an rgb image and use only its last 5 bins. Can anyone help me with the matlab code for this.

回答 (1 件)

Image Analyst
Image Analyst 2014 年 5 月 4 日
編集済み: Image Analyst 2014 年 5 月 4 日
What are you taking the histogram of? Of each color channel independently? Like:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Get histograms for each color channel:
[countsR, grayLevelsR] = imhist(redChannel, 10);
[countsG, grayLevelsG] = imhist(greenChannel, 10);
[countsB, grayLevelsB] = imhist(blueChannel, 10);
To use only the last 5 bins, you just use indexes from 6 to 10 in countsR, countsG, or countsB.
  5 件のコメント
Jyothis Jose
Jyothis Jose 2014 年 5 月 4 日
Please anyone tell me how to compute the histogram of a rgb image??.
Image Analyst
Image Analyst 2014 年 5 月 4 日
I told you how in my answer. The method you proposed is basically the histogram of all channels lumped together with even weighting, which like I said is not used very much. Usually there is a weight applied so that the green channel is more, which you can do by applying the function rgb2gray to your image before taking the histogram of it. Of course it's the histogram of the gray scale version of the image.
Attached is a demo to take the RGB Histogram of images in a folder.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by