本文整理汇总了C#中Mat.t方法的典型用法代码示例。如果您正苦于以下问题:C# Mat.t方法的具体用法?C# Mat.t怎么用?C# Mat.t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat
的用法示例。
在下文中一共展示了Mat.t方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: calc_params
public void calc_params (Point[] pts, Mat weight, float c_factor)
{
int n = pts.Length;
// assert(V.rows == 2*n);
// Debug.Log ("V.rows == 2*n " + V.rows () + " " + 2 * n);
using (Mat s = (new MatOfPoint2f (pts)).reshape (1, 2 * n)) { //point set to vector format
if (weight.empty ()) {
Core.gemm (V.t (), s, 1, new Mat (), 0, p); //simple projection
} else { //scaled projection
if (weight.rows () != n) {
Debug.Log ("Invalid weighting matrix");
}
int K = V.cols ();
using (Mat H = Mat.zeros (K, K, CvType.CV_32F))
using (Mat g = Mat.zeros (K, 1, CvType.CV_32F)) {
for (int i = 0; i < n; i++) {
using (Mat v = new Mat (V, new OpenCVForUnity.Rect (0, 2 * i, K, 2)))
using (Mat tmpMat1 = new Mat ())
using (Mat tmpMat2 = new Mat ())
using (Mat tmpMat3 = new Mat ()) {
float w = (float)weight.get (i, 0) [0];
Core.multiply (v.t (), new Scalar (w), tmpMat1);
Core.gemm (tmpMat1, v, 1, new Mat (), 0, tmpMat2);
Core.add (H, tmpMat2, H);
Core.gemm (tmpMat1, new MatOfPoint2f (pts [i]).reshape (1, 2), 1, new Mat (), 0, tmpMat3);
Core.add (g, tmpMat3, g);
}
}
Core.solve (H, g, p, Core.DECOMP_SVD);
}
}
}
clamp (c_factor); //clamp resulting parameters
}