Esempio n. 1
0
        public static List <Spot> Circles(Mat img)
        {
            var gray = img.Clone();

            if (img.Channels() > 1)
            {
                Cv2.CvtColor(img, gray, ColorConversionCodes.BGR2GRAY);
            }

            //Cv2.Flip(gray, gray, FlipMode.Y);
            var obj = Cv2.HoughCircles(gray, HoughModes.Gradient, 1, 10, 70, 10, 3, 10);

            List <Spot> spots = new List <Spot>();

            for (int i = 0; i < obj.Length; i++)
            {
                var x = obj[i].Center.X;
                var y = obj[i].Center.Y;
                var d = obj[i].Radius * 2;

                spots.Add(new Spot(new System.Windows.Point(x, y), d, Brushes.Yellow));
            }

            var sorted = PatternAnalyser.SortList(spots, true);

            return(sorted);
        }
Esempio n. 2
0
        private void OnPatternMessageReceived(string message)
        {
            var spots = PatternMessage.Parse(message, Props);

            Target      = PatternAnalyser.SortList(spots, false).ToObservableCollection();
            CalibMatrix = AffineMatrix.CalculateMatrix(Spots, Target);
        }