Simon F said:Aths,
I'd like to make comments on your work but to do it properly requires quite a bit of time and I'm really a bit busy at the moment.
Okay, which new patent got you scrambling?
Simon F said:Aths,
I'd like to make comments on your work but to do it properly requires quite a bit of time and I'm really a bit busy at the moment.
Simon F said:The way to do it is to compute the principal axis through the set of pixels in the block. You do that by computing the correlation matrix of the RGB values and then calculate the principal eigenvector of that matrix. That gives the direction of the axis which also passes through the average of the colours.
Once you have that, you can map all your pixels into a 1 dimensional system which makes it a lot simpler.
Well, an indvidual pixel that maps to a point on that line which is outside the RBG colour cube doesn't really matter. What does matter is that you choose your 2 rep colours so that they do lie inside the RGB cube, which is probably going to be very likely anyway. After all, you're going to have a distribution of pixel=>1D mappings which might look like:Hyp-X said:Simon F said:The way to do it is to compute the principal axis through the set of pixels in the block. You do that by computing the correlation matrix of the RGB values and then calculate the principal eigenvector of that matrix. That gives the direction of the axis which also passes through the average of the colours.
Once you have that, you can map all your pixels into a 1 dimensional system which makes it a lot simpler.
Sounds like how I did it for our engine.
One question though:
How do you handle the case where mapping a pixel to that axis makes the mapped pixel fall out of the [0..1] range? (That is the endpoint is not representable.)
. . A.. . . ... . . ..B. . .
Why don't map the 4x4 texels into a 1D line of 16 values in the first place? I think, the quality measurement counts the average per-texel-error, so the 2D-position the texel shouldn't matter.Simon F said:Aths,
I'd like to make comments on your work but to do it properly requires quite a bit of time and I'm really a bit busy at the moment.
But just quickly...
The way to do it is to compute the principal axis through the set of pixels in the block. You do that by computing the correlation matrix of the RGB values and then calculate the principal eigenvector of that matrix. That gives the direction of the axis which also passes through the average of the colours.aths said:Thanks to your posting, I now have a new idea of finding good S3TC reference colours:
Once you have that, you can map all your pixels into a 1 dimensional system which makes it a lot simpler.
RGB is a 3D problem. You can't immediately turn it into 1D problems because you only have one index per encoded texel.aths said:Why don't map the 4x4 texels into a 1D line of 16 values in the first place? I think, the quality measurement counts the average per-texel-error, so the 2D-position the texel shouldn't matter.
Errr... that's sort of what I'm saying. Map the 16 points onto a line but you have to choose the correct line and you get that by computing the principal axis.aths said:Why don't map the 4x4 texels into a 1D line of 16 values in the first place? I think, the quality measurement counts the average per-texel-error, so the 2D-position the texel shouldn't matter.
I am not fluid in "mathematical english", so I don't exactly know what you mean with principal axis, neither what the eigenvector is. (Even though it sounds like a germanism.) Wikipedia's explanations are very abstract so I don't really understand them.Simon F said:Errr... that's sort of what I'm saying. Map the 16 points onto a line but you have to choose the correct line and you get that by computing the principal axis.aths said:Why don't map the 4x4 texels into a 1D line of 16 values in the first place? I think, the quality measurement counts the average per-texel-error, so the 2D-position the texel shouldn't matter.
It's standard practice for vector quantisation.
zeckensack said:RGB is a 3D problem. You can't immediately turn it into 1D problems because you only have one index per encoded texel.aths said:Why don't map the 4x4 texels into a 1D line of 16 values in the first place? I think, the quality measurement counts the average per-texel-error, so the 2D-position the texel shouldn't matter.
Or did you mean something else?
Imagine a LOT of pixel values are plotted in an a RGB cube. They would form a cloud of points. The principal axis is the line going through the 'longest' part of the cloud in a "best fit" sence.aths said:I am not fluid in "mathematical english", so I don't exactly know what you mean with principal axis,
I would think it was probably Gauss or someone like that who invented it.neither what the eigenvector is. (Even though it sounds like a germanism.) Wikipedia's explanations are very abstract so I don't really understand them.
M.Ei = lambda_i * Ei
So it is a kind of a regression curve?Simon F said:Imagine a LOT of pixel values are plotted in an a RGB cube. They would form a cloud of points. The principal axis is the line going through the 'longest' part of the cloud in a "best fit" sence.aths said:I am not fluid in "mathematical english", so I don't exactly know what you mean with principal axis,
The eigenvalue is a "cell" of the matrix? Does eigenvalues and -vectors have anything to do with the determinant? Either I just don't got what you trying to explain because I cannot see the deeper sense of your formula, or this is an application of matrices I never heard of until your posting. As far as I understand, that eigen-stuff is a tool to calculate the principal axis in an efficient way.Simon F said:I would think it was probably Gauss or someone like that who invented it.neither what the eigenvector is. (Even though it sounds like a germanism.) Wikipedia's explanations are very abstract so I don't really understand them.
A simple definition: if you have a matrix M, then all of its eigenvectors, e.g. Ei, and associated scalar eigenvalue, lambda_i satisfy:
i.e. Multiplying the Matrix by the eigenvector looks like you are just scaling it by its eigenvalue.Code:M.Ei = lambda_i * Ei
The principal eigenvector is the one with the largest magnitude eigenvalue.
Anyway, these are really useful mathematical tools to understand if you are going to get involved in image compression.
I guess it is the line of best fit in N dimensional space. For example, when I wrote the VQ compressor for Dreamcast, I was computing the axis in 16 dimensional space. Luckily for you, you are probably only working in 3D RGB or YUV.aths said:So it is a kind of a regression curve?Simon F said:Imagine a LOT of pixel values are plotted in an a RGB cube. They would form a cloud of points. The principal axis is the line going through the 'longest' part of the cloud in a "best fit" sence.
Simplify the formula? It's quite straightforward. Compute the Covariance matrix, i.e. you need to compute covariances of the R,G,B etc terms of each pixel. (HMMM I just looked at that link again, and it's not the best explanation)While computable, it does not look that easy to get the principal axis, but I don't investigated possibilities yet, to simplify the formula.
I don't know that term.The eigenvalue is a "cell" of the matrix?
Errr.... I'd imagine that the product of all the eigenvalues probably equals the determinant, but I don't know for certain. I don't think it's really relevant here.Does eigenvalues and -vectors have anything to do with the determinant?
Well, it is interesting to me now because I'm involved in computer graphics. I just wish I'd been more attentive in the lectures at Uni (which were 2 years before the graphics bug bit me)Either I just don't got what you trying to explain because I cannot see the deeper sense of your formula, or this is an application of matrices I never heard of until your posting. As far as I understand, that eigen-stuff is a tool to calculate the principal axis in an efficient way.
We used the matrix mainly to get the determinant, to transform (only scale and translate iirc) or to solve equations.
May be I find a book with an explanation. That whole topic looks interesting.
He meant "element", I think. In that case the answer is no.Simon F said:I don't know that term.aths said:The eigenvalue is a "cell" of the matrix?
Or, pretty much anything. Numerical analysis is an entire field of solutions looking for problems.Anyway, these are really useful mathematical tools to understand if you are going to get involved in image compression.
Yes, I meant element.Mate Kovacs said:He meant "element", I think. In that case the answer is no.Simon F said:I don't know that term.aths said:The eigenvalue is a "cell" of the matrix?
I read some articles about the eigenvalueproblem now, but I still don't got the main idea. Also I find it confusing to read this is a method to seperate significant parameters from the others.squarewithin said:Or, pretty much anything. Numerical analysis is an entire field of solutions looking for problems.Anyway, these are really useful mathematical tools to understand if you are going to get involved in image compression.
While I also thought about modify the average tile color, that Strom and Akenine-Mollers' approach is different in some ways I thought about. Interesting, though. I took some minutes to understand how it should work. It is a clever concept to aviod a second reference colour at all.Simon F said:Aths,
Getting back to your original posting, your experiments reminded me of Strom and Akenine-Mollers' Packman texture compression method.
Well, you are virtually all the way there. You've got your covariance matrix:Hyp-X said:Ok it turns out I didn't know what eigenvectors are (I still don't quite get it.)
I simply chose the component with the largest variance and the two associated covariances and used that as the direction vector of the line.
(I used the means as the starting point.)
[ RR RG RB ]
[ RG GG GB ]
[ RB GB BB ]