public void ComputeTest2() { float[,] img1; new ImageToMatrix().Convert(Resources.tt1, out img1); float[,] img2; new ImageToMatrix().Convert(Resources.tt2, out img2); float[,] img3; new ImageToMatrix().Convert(Resources.tt3, out img3); float[,] img4; new ImageToMatrix().Convert(Resources.tt4, out img4); var hu1 = new HuMoments(img1); var hu2 = new HuMoments(img2); var hu3 = new HuMoments(img3); var hu4 = new HuMoments(img4); Assert.AreEqual(hu1.I1, hu2.I1, 0.015); Assert.AreEqual(hu1.I2, hu2.I2, 0.015); Assert.AreEqual(hu1.I3, hu2.I3, 1e-5); Assert.AreEqual(hu1.I4, hu2.I4, 1e-4); Assert.AreEqual(hu1.I5, hu2.I5, 1e-5); Assert.AreEqual(hu1.I6, hu2.I6, 1e-5); Assert.AreEqual(hu3.I1, hu4.I1, 1e-3); Assert.AreEqual(hu3.I2, hu4.I2, 1e-4); Assert.AreEqual(hu3.I3, hu4.I3, 1e-5); Assert.AreEqual(hu3.I4, hu4.I4, 1e-4); Assert.AreEqual(hu3.I5, hu4.I5, 1e-5); Assert.AreEqual(hu3.I6, hu4.I6, 1e-5); }
public void ComputeTest() { var hu0 = new HuMoments(Resources.hu0); var hu1 = new HuMoments(Resources.hu1); Assert.AreEqual(hu0.I1 / hu1.I1, 1, 0.12); Assert.AreEqual(hu0.I2 / hu1.I2, 1, 0.5); Assert.AreEqual(hu0.I3 / hu1.I3, 1, 0.7); }
public void ComputeTest() { var hu0 = new HuMoments(Accord.Imaging.Image.Clone(Resources.hu0)); var hu1 = new HuMoments(Accord.Imaging.Image.Clone(Resources.hu1)); Assert.AreEqual(hu0.I1 / hu1.I1, 1, 0.12); Assert.AreEqual(hu0.I2 / hu1.I2, 1, 0.5); Assert.AreEqual(hu0.I3 / hu1.I3, 1, 0.7); }
/// <summary> /// Matching 2 HuMoments. /// </summary> /// <param name="moment1">HuMoments1</param> /// <param name="moment2">HuMoments2</param> /// <param name="type">Matching Algorithm</param> /// <returns></returns> public static double MatchMoment(HuMoments moment1, HuMoments moment2, int type = 1) => Pipeline.Create(() => 0.0) .Pipe(p => p + Process(moment1.I1, moment2.I1, type)) .Pipe(p => p + Process(moment1.I2, moment2.I2, type)) .Pipe(p => p + Process(moment1.I3, moment2.I3, type)) .Pipe(p => p + Process(moment1.I4, moment2.I4, type)) .Pipe(p => p + Process(moment1.I5, moment2.I5, type)) .Pipe(p => p + Process(moment1.I6, moment2.I6, type)) .Pipe(p => p + Process(moment1.I7, moment2.I7, type)) .Execute();
internal static extern void cvGetHuMoments(ref Moments moments, out HuMoments hu_moments);