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

Click For Summary
SUMMARY

The discussion focuses on computing the saturation of each element in three n x n matrices using Mathematica. The saturation function is defined as S:=1-3(Min r,g,b), where r, g, and b represent the color channel matrices. The issue arises when the function returns a single value instead of an n x n matrix. The solution involves ensuring that the minimum value is computed across the corresponding elements of the matrices rather than the overall minimum of the lists.

PREREQUISITES
  • Understanding of n x n matrices
  • Familiarity with Mathematica syntax and functions
  • Knowledge of color theory related to RGB channels
  • Basic programming concepts in functional programming
NEXT STEPS
  • Learn how to manipulate matrices in Mathematica
  • Research the use of the Map function in Mathematica for element-wise operations
  • Explore the documentation for the Min function in Mathematica
  • Study examples of applying custom functions to matrices in Mathematica
USEFUL FOR

This discussion is beneficial for Mathematica users, data scientists, and anyone working with image processing or color manipulation in matrices.

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."
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K