How Can I Compute the Saturation of Each Element in a Matrix Using Mathematica?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
Agent M27
Messages
169
Reaction score
0
I have three n x n matrices for which I am try to compute the saturation of each element in the matrix. The function to find this is S:=1-3(Min r,g,b) where r,g,b are the color channel matrices. For my output I am trying to get it to return an n x n matrix with each element having the function S applied to it. When I run that code it returns a single value, not a matrix, that is between 0 & 1, which is not correct. If I change the function S for example, to be S:=1-3b, it returns the desired result of the original n x n matrix after the function has been applied. So what I think mathematica is doing is, it is comparing the elements of the three matrices and using the lowest value of all elements to compute, but what I need it to do is take the minimum valued matrix and then compute the saturation for it. Any assistance would be appreciated. Thanks.

Joe
 
Physics news on Phys.org
The documentation for Min says if it is given lists then it yields the smallest element of any of the lists and a couple seconds of experimenting seems to show this happens no matter how the lists are nested. So your guess about what it is doing appears to be correct.

Please describe simply and clearly how to "take the minimum valued matrix" and "then compute the saturation for it."