How can I create a variable changing with index number?

4 ビュー (過去 30 日間)
Mahmoud
Mahmoud 2013 年 11 月 16 日
回答済み: Image Analyst 2013 年 11 月 16 日
how can I create a variable N such that it's value changing with the index and then do the summation, i.e:
∑_Ni from i=0 to i=255 ,
where Ni is the number of pixels that have intensity value Ri
For knowledge, I have an image with its histogram.

採用された回答

Image Analyst
Image Analyst 2013 年 11 月 16 日
You can do
i = 0:255;
though you don't need to do that to take the sum. To sum the histogram of the image you can do
[pixelCounts, grayLevels] = imhist(grayscaleImage);
theSum = sum(pixelCounts(:));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by