フィルターのクリア

How to multiply every pixels?

2 ビュー (過去 30 日間)
Sneha P S
Sneha P S 2018 年 4 月 11 日
コメント済み: Matt J 2018 年 4 月 12 日
I need to find the product of every all the pixel values in a matrix. That is, if an image of size 256×256×3 is taken... i need to find the entire product of 65536 values
  4 件のコメント
Sneha P S
Sneha P S 2018 年 4 月 11 日
Ok
Sneha P S
Sneha P S 2018 年 4 月 11 日
Sorry i just meant to mention the matrix of size 256×256. Will anyone help me to do the same

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

採用された回答

Rik
Rik 2018 年 4 月 11 日
You can use prod.
A=rand(256,256);
total_product=prod(A(:));
But it is very likely that the product will be either 0, inf or -inf, because of the large number of elements.
  1 件のコメント
Matt J
Matt J 2018 年 4 月 12 日
But it is very likely that the product will be either 0, inf or -inf, because of the large number of elements.
@Sneha, Is the ulterior motive to compute the log-product? If so, better to do this by summation.
logproduct=sum(log(A(:)));

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by