6 for (
int i=0; i<3; ++i) {
7 v[i] = mat.
m[i][0]*p[0] +
16 memset(
m,0,
sizeof(
m));
17 m[0][0]=
m[1][1]=
m[2][2]=1;
24 int nr = mat->rows < 3 ? mat->rows : 3;
25 int nc = mat->cols < 4 ? mat->cols : 4;
27 for (
int r=0; r< nr; ++r) {
28 for (
int c=0; c< nc; ++c) {
29 m[r][c] = cvGetReal2D(mat, r, c);
36 memset(
m,0,
sizeof(
m));
37 m[0][0]=
m[1][1]=
m[2][2]=1;
42 for (
int i=0; i<3; i++) {
43 for (
int j=0; j<4; j++) {
57 memcpy(tmp, src, 4*
sizeof(
float));
61 for (
int i=0; i<3; ++i) {
64 dst[i] += s[j]*
m[i][j];
70 for (
int i=0; i<3; ++i) {
71 os <<
"[ " << cam.
m[i][0];
72 for (
int j=1;j<4; ++j) {
73 os <<
", " << cam.
m[i][j];
84 static const double fake[4] = {0,0,0,1};
86 for (
int i=0; i<3; i++) {
87 for (
int j=0; j<4; j++) {
115 m[0][0] = mat.
m[0][0];
116 m[0][1] = mat.
m[1][0];
117 m[0][2] = mat.
m[2][0];
118 m[0][3] = -(mat.
m[0][0]*mat.
m[0][3]+mat.
m[1][0]*mat.
m[1]
119 [3]+mat.
m[2][0]*mat.
m[2][3]);
120 m[1][0] = mat.
m[0][1];
121 m[1][1] = mat.
m[1][1];
122 m[1][2] = mat.
m[2][1];
123 m[1][3] = -(mat.
m[0][1]*mat.
m[0][3]+mat.
m[1][1]*mat.
m[1]
124 [3]+mat.
m[2][1]*mat.
m[2][3]);
125 m[2][0] = mat.
m[0][2];
126 m[2][1] = mat.
m[1][2];
127 m[2][2] = mat.
m[2][2];
128 m[2][3] = -(mat.
m[0][2]*mat.
m[0][3]+mat.
m[1][2]*mat.
m[1]
129 [3]+mat.
m[2][2]*mat.
m[2][3]);
135 double theta = angle/2;
136 double sinTheta = sin(theta);
137 double qx = sinTheta * axis[0];
138 double qy = sinTheta * axis[1];
139 double qz = sinTheta * axis[2];
140 double qw = cos( theta );
142 double xx = qx*qx;
double yy = qy*qy;
double zz = qz*qz;
143 double xy = qx*qy;
double xz = qx*qz;
double yz = qy*qz;
144 double wx = qw*qx;
double wy = qw*qy;
double wz = qw*qz;
146 m[0][0] = 1 - 2 * ( yy + zz );
147 m[0][1] = 2 * ( xy - wz );
148 m[0][2] = 2 * ( xz + wy );
151 m[1][0] = 2 * ( xy + wz );
152 m[1][1] = 1 - 2 * ( xx + zz );
153 m[1][2] = 2 * ( yz - wx );
156 m[2][0] = 2 * ( xz - wy );
157 m[2][1] = 2 * ( yz + wx );
158 m[2][2] = 1 - 2 * ( xx + yy );