Commit 68606368 authored by Ilya Lysenkov's avatar Ilya Lysenkov

Fixed #886

parent 82e12d6c
......@@ -213,13 +213,18 @@ void saveCameraParams( const string& filename,
if( !rvecs.empty() && !tvecs.empty() )
{
Mat bigmat((int)rvecs.size(), 6, CV_32F);
CV_Assert(rvecs[0].type() == tvecs[0].type());
Mat bigmat((int)rvecs.size(), 6, rvecs[0].type());
for( int i = 0; i < (int)rvecs.size(); i++ )
{
Mat r = bigmat(Range(i, i+1), Range(0,3));
Mat t = bigmat(Range(i, i+1), Range(3,6));
rvecs[i].copyTo(r);
tvecs[i].copyTo(t);
CV_Assert(rvecs[i].rows == 3 && rvecs[i].cols == 1);
CV_Assert(tvecs[i].rows == 3 && tvecs[i].cols == 1);
//*.t() is MatExpr (not Mat) so we can use assignment operator
r = rvecs[i].t();
t = tvecs[i].t();
}
cvWriteComment( *fs, "a set of 6-tuples (rotation vector + translation vector) for each view", 0 );
fs << "extrinsic_parameters" << bigmat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment