Summation Equation in matlab code

1 回表示 (過去 30 日間)
Sajina Rose
Sajina Rose 2019 年 10 月 28 日
回答済み: Wisal Adnan 2020 年 8 月 19 日
How can I write this summation equation in matlab ?
N is the number of pixel in the image

採用された回答

Bhaskar R
Bhaskar R 2019 年 10 月 28 日
Assuming are vectocrs of the length number of pixels in the image(N)
sigma = (1/N)*sum(C.^2-mu.^2);
  3 件のコメント
Bhaskar R
Bhaskar R 2019 年 10 月 28 日
Any image considered as an array in MATLAB i.e number of the array elemets are the number of the pixels in the image.
In your case number of pixels in 2D image is
% using command
N = numel(image); % this is the command to count of 2D image
% using rows and columns
[rows, columns, dim] = size(image);
N = rows*columns*dim;
Walter Roberson
Walter Roberson 2019 年 10 月 28 日
numel() of a grayscale image. size(TheImage,1)*size(TheImage,2) to know the number of pixels for RGB.
The posted code can be simplified by using
mean(C.^2-mu.^2)
Notice that the code is for the vector case, not for the 2D case. N cannot be the number of pixels because you are only using a single subscript.

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

その他の回答 (1 件)

Wisal Adnan
Wisal Adnan 2020 年 8 月 19 日
hi please can tell me how make this eq. in matlab
where n start from 2 , m&c constant value

カテゴリ

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