Integration and average of the pixel values for an image.
조회 수: 2 (최근 30일)
이전 댓글 표시
If I have a spatial map, how can I calculate the integration and average of the pixel values for the map? say my file nname is 'spatial.png' . I should get two numbers.
댓글 수: 0
채택된 답변
DGM
2021년 9월 30일
You just mean the global sum and mean? Should the image be normalized? Assuming not:
A = imread('cameraman.tif'); % this is uint8 (0-255)
sumA = sum(A,'all')
meanA = mean(A,'all')
Just to demonstrate that it makes sense:
sumA/numel(A) % same as the mean
댓글 수: 2
DGM
2021년 9월 30일
You must be using an older version. I don't remember when the options changed, but this should do the same:
sumA = sum(A(:))
meanA = mean(A(:))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Octave에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!