I have 3 eqns and 2 unknowns Hb and Hbo2, they look like this:
Bxy = AB * HB + AB * Hbo2
Rxy = AR * HB + AR * Hbo2
Gxy = AG * HB + AG * Hbo2
Now I have been trying to use a matrix method in order to solve the unknowns for them equations, which is a pain in the ass cause when I convert it to matrix form I get an irregular matrix because it is 2 unknowns and 3 equations.
Does anyone on here know how to solve n number of equations with n-1 unknowns.
EDIT
Thanks for the responses so far, they have been great.
To help make this more clear, what I am trying to do is work out the concentration of oxygenated and deoxygenated blood at a given pixel in an image. so the variables above correspond to the following.
Rxy Gxy and Bxy, red green or blue absorbed at position x,y. (value between 0 - 255)
AR, AG, AB is the absorption coefficient of light for Red geen and blue wavelengths for blood. (HOWEVER there is a possibility I might have to define different absorption coefficients for oxygenated and deoxygenated blood (as they absorb different amounts of light)).
Hb and Hbo2 is the concentration of Oxygenated and Deoxygenated blood. (these are unknown as I'm trying to map the RGB values to this)
However I have also noticed that the coefficients for Oxygenated and Deoxygenated blood are different so this means the equation could possibly be the following.
Bxy = (ABhb * HB) + (ABhbo2 * Hbo2)
Rxy = (ARhb * HB) + (ARhbo2 * Hbo2)
Gxy = (AGhb * HB) + (AGhbo2 * Hbo2)
The only difference in the above is that the coefficients are different for oxygenated and deoxygenated blood.
This is all part of my Final Year Project at uni for Computer Science, trying to do some functional imaging.
@Chris does the same apply if there is different coefficients, sorry for lack of understanding, Maths is not my strongest point. Just trying to program this algorithm.
What you probably want is what's called the least squares solution (see the section on the general problem). To summarize, you are not guaranteed an exact solution depending on your
A
andb
when you are trying to solveA*x=b
here.However, by computing
xLS = inv(A'*A)*A'*b
you'll get something that's as close as possible to a solution (in the least squares sense). Note thatA'
means the transpose ofA
. Also note, ifA'*A
is not invertible then your system of equations is rank deficient (that means you effectively have less equations than you think.)If you have:
Then: