How to multiply every pixels?
조회 수: 2 (최근 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에서 Frequency Transformations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!