Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How does calibrateCamera works under hood?

This is the fragment of code INSIDE my own function.

rvecs = std::vector<cv::Mat>();
tvecs = std::vector<cv::Mat>();
cv::calibrateCamera(objectPoints, imagePoints, boardSize, cameraMatrix, distCoeffs, rvecs, tvecs, flag);    
std::cout<<"\nrvecs:\n"<<rvecs.at(1)<<"\ntvecs:\n"<<tvecs.at(1)<<std::endl;

And it gives an output:

**rvecs: [-2.07794159464744; 1.839724077653041; -0.9104975914162868]
tvecs: [81.31706021250416; 213.1216587926538; 367.8369235219837]**

And it's nice to see any result but:
I am wondering how this function changes the values of rvecs and tvecs, because they are both local variables and according to the documentation it gets variables, not references so I thought they are copied and my results will be something zero-like. Is it different for containers (vector) of objects of external classes (Mat)? Aren't they passed by value?

How does calibrateCamera works under hood?

This is the fragment of code INSIDE my own function.

rvecs = std::vector<cv::Mat>();
tvecs = std::vector<cv::Mat>();
cv::calibrateCamera(objectPoints, imagePoints, boardSize, cameraMatrix, cv::calibrateCamera(objPts, imPts, boardSz, camMatrix, distCoeffs, rvecs, tvecs, flag);    
std::cout<<"\nrvecs:\n"<<rvecs.at(1)<<"\ntvecs:\n"<<tvecs.at(1)<<std::endl;

And it gives an output:

**rvecs: [-2.07794159464744; 1.839724077653041; -0.9104975914162868]
tvecs: [81.31706021250416; 213.1216587926538; 367.8369235219837]**

And it's nice to see any result but:
I am wondering how this function changes the values of rvecs and tvecs, because they are both local variables and according to the documentation it gets variables, not references so I thought they are copied and my results will be something zero-like. Is it different for containers (vector) of objects of external classes (Mat)? Aren't they passed by value?

How does calibrateCamera works under hood?

This is the fragment of code INSIDE my own function.

rvecs = std::vector<cv::Mat>();
tvecs = std::vector<cv::Mat>();
cv::calibrateCamera(objPts, imPts, boardSz, camMatrix, distCoeffs, rvecs, tvecs, flag);    
std::cout<<"\nrvecs:\n"<<rvecs.at(1)<<"\ntvecs:\n"<<tvecs.at(1)<<std::endl;

And it gives an output:

**rvecs:

rvecs: [-2.07794159464744; 1.839724077653041; -0.9104975914162868]
tvecs: [81.31706021250416; 213.1216587926538; 367.8369235219837]**

367.8369235219837]

And it's nice to see any result but:
I am wondering how this function changes the values of rvecs and tvecs, because they are both local variables and according to the documentation it gets variables, not references so I thought they are copied and my results will be something zero-like. Is it different for containers (vector) of objects of external classes (Mat)? Aren't they passed by value?

How does calibrateCamera works under hood?

This is the fragment of code INSIDE my own function.

rvecs = std::vector<cv::Mat>();
tvecs = std::vector<cv::Mat>();
cv::calibrateCamera(objPts, imPts, boardSz, camMatrix, distCoeffs, rvecs, tvecs, flag);    
std::cout<<"\nrvecs:\n"<<rvecs.at(1)<<"\ntvecs:\n"<<tvecs.at(1)<<std::endl;
std::cout<<"\nrvecs: "<<rvecs.at(1)<<"\ntvecs: "<<tvecs.at(1)<<std::endl;

And it gives an output:

rvecs: [-2.07794159464744; 1.839724077653041; -0.9104975914162868]
tvecs: [81.31706021250416; 213.1216587926538; 367.8369235219837]

And it's nice to see any result but:
I am wondering how this function changes the values of rvecs and tvecs, because they are both local variables and according to the documentation it gets variables, not references so I thought they are copied and my results will be something zero-like. Is it different for containers (vector) of objects of external classes (Mat)? Aren't they passed by value?

How does calibrateCamera works under hood?

This is the fragment of code INSIDE my own function.

rvecs = std::vector<cv::Mat>();
tvecs = std::vector<cv::Mat>();
cv::calibrateCamera(objPts, imPts, boardSz, camMatrix, distCoeffs, rvecs, tvecs, flag);    
std::cout<<"\nrvecs: "<<rvecs.at(1)<<"\ntvecs: "<<tvecs.at(1)<<std::endl;
std::cout<<"\nrvecs:\n"<<rvecs.at(1)<<"\ntvecs:\n"<<tvecs.at(1)<<std::endl;

And it gives an output:

rvecs: [-2.07794159464744; 1.839724077653041; -0.9104975914162868]
tvecs: [81.31706021250416; 213.1216587926538; 367.8369235219837]

And it's nice to see any result but:
I am wondering how this function changes the values of rvecs and tvecs, because they are both local variables and according to the documentation it gets variables, not references so I thought they are copied and my results will be something zero-like. Is it different for containers (vector) of objects of external classes (Mat)? Aren't they passed by value?