示例#1
0
        public void TestMatchTemplate()
        {
            ImageArray  image    = SimulateBlackImageWithWhitePatch(41, 41, new Int32Rect(12, 23, 10, 10));
            ImageArray  template = SimulateBlackImageWithWhitePatch(21, 21, new Int32Rect(10, 10, 10, 10));
            DoubleArray match    = image.MatchTemplate(template, TemplateMatchingMethod.SquaredDifference);

            var minLoc = match.MinLoc();

            Assert.AreEqual(minLoc.X, 2, 1e-3);
            Assert.AreEqual(minLoc.Y, 13, 1e-3);
        }