本文整理汇总了C++中cv::Mat_::inv方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat_::inv方法的具体用法?C++ Mat_::inv怎么用?C++ Mat_::inv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::Mat_
的用法示例。
在下文中一共展示了Mat_::inv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Find 3D rotation and translation with homography (i.e. calibration boards position in the camera cooperate system )
* @param homo: [Input] Estimated Homography
* @param rot: [Output] Rotation result
* @param trans: [Output] Translation result
*/
void AugmentationEnvironment::H2Rt(const cv::Mat_<double> intrisinc, const cv::Mat_<double>& homo, cv::Mat_<double>& rot, cv::Mat_<double> &trans)
{
double coefH;
cv::Mat_<double> invcam = intrisinc.inv();
rot = invcam*homo;
//scaling rotation matrix to right order = find the coefficient lost while calculating homography
/**
* [Cam]*[Rot]' = [Homo]*coefH
* |fx 0 u0|
* [Cam]' = | 0 fy v0|
* | 0 0 1|
*
* |R11 R12 t1|
* [Rot]' = |R21 R22 t2|
* |R31 R32 t3|
*
* |H11 H12 H13|
* [Homo]' = |H21 H22 H23|
* |H31 H32 1|
*/
coefH = 2/(cv::norm(rot.col(0)) + cv::norm(rot.col(1)));
rot = rot * coefH;
trans = rot.col(2).clone();
//The their rotation vector in the rotation matrix is produced as the cross product of other two vectors
cv::Mat tmp = rot.col(2);
rot.col(0).cross(rot.col(1)).copyTo(tmp);
//Add here to make rotation matrix a "real" rotation matrix in zhang's method
/**
* rot = UDVt
* rot_real = UVt
*/
cv::Mat_<double> D,U,Vt;
cv::SVD::compute(rot,D,U,Vt);
rot = U*Vt;
}
示例2: hotelling1_t2_score
T hotelling1_t2_score(
cv::Mat_<T> mean1, cv::Mat_<T> mean2, cv::Mat_<T> cov1, unsigned n1){
unsigned k=mean1.size[0];
cv::Mat_<T > mean_diff=mean1-mean2;
T t2_score= mean_diff.dot(cov1.inv() * mean_diff)*n1;
return t2_score;}