How to multiply every pixels?
3 次查看(过去 30 天)
显示 更早的评论
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
采纳的回答
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
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 Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!