mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Fixed #886
This commit is contained in:
parent
82e12d6c59
commit
686063689c
@ -213,13 +213,18 @@ void saveCameraParams( const string& filename,
|
|||||||
|
|
||||||
if( !rvecs.empty() && !tvecs.empty() )
|
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++ )
|
for( int i = 0; i < (int)rvecs.size(); i++ )
|
||||||
{
|
{
|
||||||
Mat r = bigmat(Range(i, i+1), Range(0,3));
|
Mat r = bigmat(Range(i, i+1), Range(0,3));
|
||||||
Mat t = bigmat(Range(i, i+1), Range(3,6));
|
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 );
|
cvWriteComment( *fs, "a set of 6-tuples (rotation vector + translation vector) for each view", 0 );
|
||||||
fs << "extrinsic_parameters" << bigmat;
|
fs << "extrinsic_parameters" << bigmat;
|
||||||
|
Loading…
Reference in New Issue
Block a user