Covariance matrix in barycentric coordinates

In summary, MarkoDe is seeking insight on how to transform a covariance matrix from Cartesian coordinates to barycentric coordinates, in order to represent the covariance matrix for a point in three-dimensional space that was estimated using sensors with associated noise. The barycentric coordinates in this case refer to a specific parametrization of a triangle, and the main conceptual issue is how to express the estimate of the point's location in barycentric coordinates. The covariance was calculated using Gaussian random variables and the Jacobian of the triangulation algorithm, and the transformation process involves finding a transformation that makes sense in the context of transforming one coordinate system to another.
  • #1
MarkoDe
8
0
Hi folks,

I know the covariance matrix and the location of a point, both of which are expressed in Cartesian coordinates. I am going to represent the point in barycentric coordinates, and I would like to represent the covariance matrix for the point in barycentric coordinates as well. Does anyone have any insight into how to do transform the covariance matrix from Cartesian to barycentric coordinates?

Thanks!
MarkoDe
 
Physics news on Phys.org
  • #2
MarkoDe said:
I know the covariance matrix and the location of a point

Covariance is a concept defined for random variables or samples of random variables, so I can't resist asking how you know the covariance matrix of a single point. How does this point relate to a random variable?
 
  • #3
Hey MarkoDe and welcome to the forums.

I can't comment specifically on what you are doing and what the random variable presents but what I can say relates to random variables in general (regardless of the problem or thing they represent).

As far as I am aware from prior work I have done, barycentric coordinates refer to a specific parametrization of a triangle with (u,v) as its coordinates.

The cartesian model is not bounded for one and I think its important you tell us exactly what you are trying to parametrize and transform. If you are referring to a barycentric representation that is not based on a triangle, then that would be helpful.

Anyway the standard transformation to find moments (and hence variance/covariance) of a random variable is to use the definition of expectation of a transformed variable which is basically E[f(x)] and then to use that in the context of variance/covariance.

It will help us if you define what your random variables and what they represent to give you more specific advice.
 
  • #4
Thanks for the replies, and for encouraging me to better define my query.

What I have:
I have an estimate of the location of a point in three dimensionsal space, which is expressed in Cartesian coordinates. The estimate was formed using sensors with some associated noise (in this case multiple photographs from a single camera which has undergone translation and rotation.)

I have a model for the noise in the sensor measurements. This model has allowed me to form an estimate of the covariance of the estimate of the point's location. The position estimate is in X,Y,Z, and the covariance matrix is the 3x3 matrix that expresses the uncertainty in that estimate.

So the barycentric coordinates would require the control points to form a pyramid, since three dimensional space is being parameterized. I'm just getting into the concept of barycentric coordinates, so please forgive me if I mess up the jargon. The barycentric coordinates are to some extent arbitrary; they can be chosen to bound the estimate of the point's location, although I believe that, if it is poosible to express a point that lies outside of the pyramid, this will be useful.

My main conceptual issue is, how do I espress my estimate for the covariance of the estimate of the point's location in the barycentric coordinates?

I appreciate your help!
MarkoDe
 
  • #5
MarkoDe, what you calculated the variance/mean/covariance using an existing method or by using existing data or have you just obtained those values by just 'plugging them in' or 'getting them from another source'?

As I pointed out before, once you know how to represent the transformed random variable (example X is random variable now you have Y = f(X) which is new random variable), then you can just use E[f(X)] and other things to calculate things like variance and covariance (instead E[X]E[Y] terms you will use something like E[f(X)]E[g(Y)] terms).

It would help if you gave us this information.
 
  • #6
Thanks for your response, chiro.

MarkoDe, what you calculated the variance/mean/covariance using an existing method or by using existing data or have you just obtained those values by just 'plugging them in' or 'getting them from another source'?

The mean is the output of triangulation algorithms, as described earlier. An example is available in the excellent computer vision book by Hartley and Zisserman, Multiple View Geometry:
Multiple View Geometry on Google books

The covariance is calculated by identifying the input error sources for the triangulation algorithms, such as pixel jitter and errors in the rotation/translation, modelling them as Gaussian random variables, assigning reasonable values to them through data analysis and experimentation, calculating the Jacobian of the triangulation algorithms, and propoagating the input error sources to form an covariance estimate of the output:
P_o = J*P_in*J^t
Where J is the Jacobian, P_in is the covariance matrix formed from the input variables, and P_o is the output.

As I pointed out before, once you know how to represent the transformed random variable (example X is random variable now you have Y = f(X) which is new random variable), then you can just use E[f(X)] and other things to calculate things like variance and covariance (instead E[X]E[Y] terms you will use something like E[f(X)]E[g(Y)] terms).

Ok, this makes sense to me. How to apply it, not so much. :smile:

Thanks again!
 
  • #7
MarkoDe said:
Thanks for your response, chiro.
Ok, this makes sense to me. How to apply it, not so much. :smile:

Thanks again!

Basically it works the same way that you would consider it work on a say a normal function.

For example f(x) = x^2 transforms a line to a parabola. Something closer to home with your problem would involve the translation between coordinate systems. For example a transformation from (x,y) to (r,theta) is basically r = SQRT(x^2 + y^2) and theta = arctan(y/x) with appropriate modifications for appropriate quadrants.

This is basically what you have to do. You need to find a transformation that makes sense in the context of transforming one coordinate system to another, but you are doing it for your random variables.

I will need a little time to see how your R.V's are calculated, but basically all I would do is to apply the above idea in the context of what the R.V's represent. Once you relate the transforms from your cartesian system to your barycentric system and your R.V's in the context of your original system, then the transformation becomes a lot more intuitive.
 
  • #8
MarkoDe,

State the formula that you are using to convert (X,Y,Z) to barycentric coordinates.
 
  • #9
Hi Stephen and chiro.

A point [itex]p[/itex] in Cartesian coordinates can be expressed in barycentric coordinates as:

[itex]p=\Sigma^{4}_{i=1}\alpha_{i}c_{i}[/itex]

where [itex]c_{i}[/itex] is one of four control points, and [itex]\alpha[/itex] is the weight for each control point.

In this work, the following constraint is applied:

[itex]\Sigma^{4}_{i=1}\alpha_{i}=1[/itex]

To transform the Cartesian coordinates into barycentric coordinates:
1. First define the Cartesian coordinates as homogeneous:

[itex]p_{c}=\left[X\ Y\ Z\right]^{T}\rightarrow\left[X\ Y\ Z\ 1\right]^{T}[/itex]

2. Choose the location of the four barycentric coordinates [itex]c_{i}[/itex]. This can theoretically be done arbitrarily. For this work, the barycentric coordinates are chosen so that the one of the points is at the origin of the center of mass of the points to be transformed, and the other points are 1 unit along each of the principal axes of the cartesian coordinate system. The upshot is that the locations [itex]c_{i}[/itex] are known. They, too, are defined homogeneously.

For example, if the center of mass of the points to be transformed is at the origin, the values for [itex]c_{i}[/itex] would be:

[itex]c_{1} = \left[1\ 0\ 0\ 1\right]^{T}[/itex]

[itex]c_{2} = \left[0\ 1\ 0\ 1\right]^{T}[/itex]

[itex]c_{3} = \left[0\ 0\ 1\ 1\right]^{T}[/itex]

[itex]c_{4} = \left[0\ 0\ 0\ 1\right]^{T}[/itex]

The matrix [itex]C[/itex] is defined where each column is one of the barycentric coordinates:

[itex]C = \left[c_{1}\ c_{2}\ c_{3}\ c_{4}\right][/itex]

3. For the point [itex]p[/itex], compute the values for [itex]\alpha_{i}[/itex]:

[itex]A=\left[\alpha_{1}\ \alpha_{2}\ \alpha_{3}\ \alpha_{4}\right]^{T}[/itex]

[itex]A=C^{-1}p[/itex]

Which allows the Cartesian point [itex]p[/itex] to be expressed in barycentric coordinates as:

[itex]p=CA[/itex]

Thanks again for your help and feedback!
MarkoDe
 
  • #10
MarkoDe said:
[itex]A=C^{-1}p[/itex]


If read this correctly, it says that each [itex] \alpha_i [/itex] is a linear combination of the cartestian coordinates plus a constant term. So, for example, you could have something like [itex] \alpha_1 = 3.3 x - 2.6 y + 11.2 z + 7.6 [/itex]

Is that correct? And you want to know quantities like [itex] VAR(\alpha_1) [/itex] and [itex] COV(\alpha_1, \alpha_2) [/itex] ?
 
  • #11
Stephen, your interpretation looks correct to me. And I am indeed interested in quantities like [itex] VAR(\alpha_1) [/itex] and [itex] COV(\alpha_1, \alpha_2) [/itex].

Now that you guys have prodded me into formulating the question correctly, and you've interpreted it like that, the answer is beginning to be apparent.

Denoting [itex]C^{-1}[/itex] as [itex]\widehat{C}[/itex], and the subscripts [itex]i,j[/itex] as the row and column indices,

[itex] \alpha_1 = \widehat{C}_{1,1}p_{1} + \widehat{C}_{1,2}p_{2} + \widehat{C}_{1,3}p_{3} + \widehat{C}_{1,4}[/itex]

[itex] \alpha_2 = \widehat{C}_{2,1}p_{1} + \widehat{C}_{2,2}p_{2} + \widehat{C}_{2,3}p_{3} + \widehat{C}_{2,4}[/itex]

[itex] \alpha_3 = \widehat{C}_{3,1}p_{1} + \widehat{C}_{3,2}p_{2} + \widehat{C}_{3,3}p_{3} + \widehat{C}_{3,4}[/itex]

[itex] \alpha_4 =\widehat{C}_{4,1}p_{1} + \widehat{C}_{4,2}p_{2} + \widehat{C}_{4,3}p_{3} + \widehat{C}_{4,4}[/itex]

So, solving [itex] COV(\alpha_1, \alpha_2) [/itex] for example:

[itex] COV(\alpha_1, \alpha_2) = E\left[\left(\alpha_1 - E\left[\alpha_1\right]\right)\left(\alpha_2 - E\left[\alpha_2\right]\right)\right] [/itex]

[itex] = E\left[ \left(\widehat{C}_{1,1}p_{1} + \widehat{C}_{1,2}p_{2} + \widehat{C}_{1,3}p_{3} + \widehat{C}_{1,4} - E\left[ \widehat{C}_{1,1}p_{1} + \widehat{C}_{1,2}p_{2} + \widehat{C}_{1,3}p_{3} + \widehat{C}_{1,4}\right]\right)\left(\widehat{C}_{2,1}p_{1} + \widehat{C}_{2,2}p_{2} + \widehat{C}_{2,3}p_{3} + \widehat{C}_{2,4} - E\left[\widehat{C}_{2,1}p_{1} + \widehat{C}_{2,2}p_{2} + \widehat{C}_{2,3}p_{3} + \widehat{C}_{2,4}\right]\right)\right] [/itex]

[itex] = E\left[ \left(\widehat{C}_{1,1}p_{1} + \widehat{C}_{1,2}p_{2} + \widehat{C}_{1,3}p_{3} + \widehat{C}_{1,4} - E\left[ \widehat{C}_{1,1}p_{1}\right] - E\left[ \widehat{C}_{1,2}p_{2}\right] - E\left[ \widehat{C}_{1,3}p_{3}\right] - E\left[ \widehat{C}_{1,4}\right]\right)\left(\widehat{C}_{2,1}p_{1} + \widehat{C}_{2,2}p_{2} + \widehat{C}_{2,3}p_{3} + \widehat{C}_{2,4} - E\left[\widehat{C}_{2,1}p_{1}\right] - E\left[ \widehat{C}_{2,2}p_{2}\right] - E\left[ \widehat{C}_{2,3}p_{3}\right] - E\left[ \widehat{C}_{2,4}\right]\right)\right] [/itex]

[itex] = E\left[ \left(\widehat{C}_{1,1}\left(p_{1} - E\left[p_{1}\right]\right) + \widehat{C}_{1,2}\left(p_{2} - E\left[p_{2}\right]\right) + \widehat{C}_{1,3}\left(p_{3} - E\left[ p_{3}\right]\right)\right)\left(\widehat{C}_{2,1}\left(p_{1} - E\left[p_{1}\right]\right) + \widehat{C}_{2,2}\left(p_{2} - E\left[p_{2}\right]\right) + \widehat{C}_{2,3}\left(p_{3} - E\left[ p_{3}\right]\right)\right)\right] [/itex]

[itex] = \widehat{C}_{1,1}\widehat{C}_{2,1}E\left[\left(p_{1} - E\left[p_{1}\right]\right)^{2}\right] + \widehat{C}_{1,1}\widehat{C}_{2,2}E\left[\left(p_{1} - E\left[p_{1}\right]\right)\left(p_{2} - E\left[p_{2}\right]\right)\right] + \widehat{C}_{1,1}\widehat{C}_{2,3}E\left[\left(p_{1} - E\left[p_{1}\right]\right)\left(p_{3} - E\left[p_{3}\right]\right)\right] [/itex]

[itex]+ \widehat{C}_{1,2}\widehat{C}_{2,1}E\left[\left(p_{2} - E\left[p_{2}\right]\right)\left(p_{1} - E\left[p_{1}\right]\right)\right] + \widehat{C}_{1,2}\widehat{C}_{2,2}E\left[\left(p_{2} - E\left[p_{2}\right]\right)^{2}\right]+ \widehat{C}_{1,2}\widehat{C}_{2,3}E\left[\left(p_{2} - E\left[p_{2}\right]\right)\left(p_{3} - E\left[p_{3}\right]\right)\right][/itex]

[itex]+ \widehat{C}_{1,3}\widehat{C}_{2,1}E\left[\left(p_{3} - E\left[p_{3}\right]\right)\left(p_{1} - E\left[p_{1}\right]\right)\right] + \widehat{C}_{1,3}\widehat{C}_{2,2}E\left[\left(p_{3} - E\left[p_{3}\right]\right)\left(p_{2} - E\left[p_{2}\right]\right)\right] + \widehat{C}_{1,3}\widehat{C}_{2,3}E\left[\left(p_{3} - E\left[p_{3}\right]\right)^{2}\right] [/itex]

where [itex]E\left[\left(p_{1} - E\left[p_{1}\right]\right)^{2}\right][/itex], [itex]E\left[\left(p_{2} - E\left[p_{2}\right]\right)^{2}\right][/itex], [itex]E\left[\left(p_{3} - E\left[p_{3}\right]\right)^{2}\right][/itex], [itex] E\left[\left(p_{1} - E\left[p_{1}\right]\right)\left(p_{2} - E\left[p_{2}\right]\right)\right][/itex], [itex]E\left[\left(p_{1} - E\left[p_{1}\right]\right)\left(p_{3} - E\left[p_{3}\right]\right)\right][/itex], and [itex]E\left[\left(p_{2} - E\left[p_{2}\right]\right)\left(p_{3} - E\left[p_{3}\right]\right)\right] [/itex] are all known from the entries of the input covariance matrix of [itex]p[/itex],

and the entries of [itex]C_{i,j}[/itex] are also known.

Is there a more elegant way to express this? Writing that out for every all the combinations of [itex]\alpha[/itex]'s is pretty cumbersome.

Thanks again for your help, and for prodding me to get this into a form where the answer was apparent!
 
  • #12
MarkoDe said:
Thanks again for your help, and for prodding me to get this into a form where the answer was apparent!

I can see a kind of 'covariance' relation with your last expression. Also when you refer to terms about (p1 - E[p1])^2, this is basically a variance term for p1.

The best way I can think of is to change the E[(p1 - E[p1)^2] terms normal VAR(p1) terms and do the same for COV terms. Then you might have to do some kind of matrix factorization and create two matrices since i see the (2,1), (2,2), and (2,3) terms for your C-inverse matrix repeated which means they can be factorized out into a different matrix.

Another approach would be to write your system in the normal covariance matrix format (which basically does COV(a,b) for every a and b that are random variables in your system) and based on that you can make an interpretation of what all of it actually means.
 
  • #13
MarkoDe said:
Is there a more elegant way to express this?

Probably, but first we should look for a more elegant way to derive the answer. I think the COV(X,Y) operation is "bi-linear", so you can use that fact instead of using expectations and the definition of covariance.
 
  • #14
I'm interested in following your intuition, Stephen, but I don't quite understand. Wikipedia's definition for 'bilinear' didn't shed any light. Would you care to comment more?
 
  • #15
I'll take a stab at simplifying.

First, some notation:
[itex]\widehat{c}_{i}[/itex] is the row vector from the ith row of the matrix [itex]\widehat{C} = C^{-1}[/itex]
[itex]P_{p}[/itex] is the 3x3 covariance matrix for the mean estimate [itex]p[/itex].
[itex]P_{\alpha}[/itex] is the 4x4 covariance matrix for the [itex]\alpha[/itex] values.
[itex] i,j [/itex] are the row, column indices for a matrix.
[itex] \bullet [/itex] denotes the dot product.

Then the covariance matrix [itex]P_{\alpha}[/itex] is computed as:

[itex]P_{\alpha,i,j}=\widehat{c}^{T}_{i}\bullet\left(P_{p} \widehat{c}^{T}_j\right)[/itex]

Looks nifty enough that I am satisfied. However, if you guys have additional insight, or a more elegant way of expressing/solving, then I am definitely interested.

Thanks again for your help!

MarkoDe
 
  • #16
MarkoDe said:
I'm interested in following your intuition, Stephen, but I don't quite understand. Wikipedia's definition for 'bilinear' didn't shed any light. Would you care to comment more?

Look at the Wikipedia article on Covariance. The property
Cov(aX + bY,cW+dV) =ac Cov(X,W) + ad Cov(X,V) + bc Cov(Y,W) + bd Cov(Y,V)
summarizes most of what you need.
 

What is a covariance matrix in barycentric coordinates?

A covariance matrix in barycentric coordinates is a mathematical tool used to describe the relationship between multiple variables in a barycentric coordinate system. It contains information about the variance and covariance of the variables, which can be used to analyze the strength and direction of their relationship.

How is a covariance matrix in barycentric coordinates calculated?

A covariance matrix in barycentric coordinates is calculated by first converting the data into barycentric coordinates and then using a formula to calculate the covariance between each pair of variables. The resulting matrix will have the variances on the diagonal and the covariances on the off-diagonal entries.

What is the significance of a covariance matrix in barycentric coordinates?

A covariance matrix in barycentric coordinates is useful for understanding the relationships between variables in a barycentric coordinate system. It can help identify patterns and correlations that may not be evident in other coordinate systems and can be used for statistical analysis and prediction.

Can a covariance matrix in barycentric coordinates be used for data visualization?

Yes, a covariance matrix in barycentric coordinates can be used for data visualization by plotting the relationships between variables in a barycentric coordinate system. This can provide a visual representation of the data and help identify any patterns or trends.

How is a covariance matrix in barycentric coordinates interpreted?

The values in a covariance matrix in barycentric coordinates can be interpreted as follows: the diagonal entries represent the variance of each variable, while the off-diagonal entries represent the covariance between pairs of variables. A positive covariance indicates a positive relationship between the variables, while a negative covariance indicates a negative relationship. A covariance of 0 indicates no linear relationship between the variables.

Similar threads

  • Linear and Abstract Algebra
Replies
1
Views
837
  • Linear and Abstract Algebra
Replies
2
Views
2K
  • Linear and Abstract Algebra
Replies
5
Views
2K
  • Programming and Computer Science
Replies
3
Views
2K
  • Linear and Abstract Algebra
Replies
2
Views
606
Replies
3
Views
399
  • Quantum Interpretations and Foundations
2
Replies
42
Views
5K
Replies
12
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
765
Back
Top