How to multiply every pixels?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Rik
am 11 Apr. 2018
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 Kommentar
Matt J
am 12 Apr. 2018
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(:)));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Frequency Transformations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!