Updated by Kirill Kornyakov over 12 years ago
in cvDecomposeProjectionMatrix the call to cvGetCols modifies the data address of tmpMatrix here's the fix:
<pre>
....
CvMat tmpMatrixSquare;//MY FIX HERE TO PREVENT MEMORY LEAK (was using tmpMatrix but that already has memory allocated
cvGetCols(projMatr, &tmpMatrixSquare, 0, 3); // M is first square matrix of P.
assert(cvDet(&tmpMatrixSquare) != 0.0); // So far only finite cameras could be decomposed, so M has to be nonsingular [det(M) != 0].
cvRQDecomp3x3(&tmpMatrixSquare, calibMatr, rotMatr, rotMatrX, rotMatrY, rotMatrZ, eulerAngles);
....
</pre>
Your welcome! cost me a day
by the way v2.4 leaks like a sieve so I just went back to 2.0 and fixed that.
<pre>
....
CvMat tmpMatrixSquare;//MY FIX HERE TO PREVENT MEMORY LEAK (was using tmpMatrix but that already has memory allocated
cvGetCols(projMatr, &tmpMatrixSquare, 0, 3); // M is first square matrix of P.
assert(cvDet(&tmpMatrixSquare) != 0.0); // So far only finite cameras could be decomposed, so M has to be nonsingular [det(M) != 0].
cvRQDecomp3x3(&tmpMatrixSquare, calibMatr, rotMatr, rotMatrX, rotMatrY, rotMatrZ, eulerAngles);
....
</pre>
Your welcome! cost me a day
by the way v2.4 leaks like a sieve so I just went back to 2.0 and fixed that.