How can I create a variable changing with index number?

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개)

카테고리

도움말 센터File Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

질문:

2013년 11월 16일

답변:

2013년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by