Пример #1
0
 public static Func<PointF[], PointF[]> FindHomography(PointF[] ccs, PointF[] pcs)
 {
     var hg = Emgu.CV.CameraCalibration.FindHomography(ccs, pcs, HOMOGRAPHY_METHOD.DEFAULT, 2);
     var t = ccs.Select(c => new PointF(c.X, c.Y)).ToArray();
     hg.ProjectPoints(t);
     var tes = pcs.Zip(t, (a, b) => (b.X - a.X) * (b.X - a.X) + (b.Y - a.Y) * (b.Y - a.Y)).ToArray();
     var sum = tes.Sum();
     return (ps) =>
     {
         var psc = ps.Select(p => new PointF(p.X, p.Y)).ToArray();
         hg.ProjectPoints(psc);
         return psc;
     };
 }
Пример #2
0
 public static bool Different(PointF[] a, PointF[] b, float thresh = 400)
 {
     if (b == null || a == null)
         return true;
     var diff = a.Zip(b, (ap, bp) => Math.Abs(ap.X - bp.X) + Math.Abs(ap.Y - bp.Y)).Sum();
     return diff > thresh;
 }