コード例 #1
0
        public IList <CircleSearchingResult> SearchCircles(HImage image, IList <CircleSearchingDefinition> circleSearchingDefinitions)
        {
            var    searchingResult = new CircleSearchingResultCollection();
            Random random          = new Random();

            for (int i = 0; i < circleSearchingDefinitions.Count; i++)
            {
                var definition   = circleSearchingDefinitions[i];
                int randomFactor = 0;
                var csr          = new CircleSearchingResult()
                {
                    Index  = i,
                    Name   = definition.Name,
                    Circle =
                        new Circle(definition.CenterX + random.NextDouble() * randomFactor,
                                   definition.CenterY + random.NextDouble() * randomFactor,
                                   (definition.InnerRadius + definition.OuterRadius) / 2.0 + random.NextDouble() * randomFactor),
                    Definition = definition.DeepClone(),
                };
                //                if (i == 2)
                //                    csr.IsNotFound = true;

                searchingResult.Add(csr);
            }

            return(searchingResult);
        }
コード例 #2
0
        public static IList <CircleSearchingResult> SearchCircles(this ICircleInspector inspector, HImage image,
                                                                  IList <CircleSearchingDefinition>
                                                                  definitions)
        {
            var csrs = new CircleSearchingResultCollection();

            int index = 0;

            foreach (var definition in definitions)
            {
                var csr = inspector.SearchCircle(image, definition);
                csr.Index = index;
                csrs.Add(csr);
                index++;
            }
            return(csrs);
        }