A simple question on matrix in opengl and opencv

I have some code which has matrix in opencv. Now I would like to use opengl for further modeling. Suppose I have the following matrix:

double mat[16] = { 1.0, 0.0, -a, 0.0, 0.0, 1.0, -b, 0.0, 0.0, 0.0, -c, 0.0, 0.0, 0.0, 0.0, 1.0};

I think opengl use column major order as follows:

1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
-a -b -c 0.0
0.0 0.0 0.0 1.0

whereas opencv use the row major order as follows:

1.0 0.0 -a 0.0
0.0 1.0 -b 0.0
0.0 0.0 -c 0.0
0.0 0.0 0.0 1.0

Please let me know if i am not right.

OpenGL uses column-major order by default (the “transpose” versions of functions use row-major order). OpenCV uses row-major order by default, but can use column-major order (the stride or step for each dimension can be set explicitly).

However, if your example matrix was supposed to be a translation, it’s transposed (also, the wrong column is used). A matrix for a translation by the vector (x,y,z) looks like:


1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1

Actually, the matrix is not a translation matrix, it is a rotation matrix. Apart from row-major and column-major order, is there any other difference due to the coordinate system? Please let me know.