示例#1
0
        public static Shapes.Thing FindClosest(VideoProcessing vp, Shapes.ShapeTypes type, double FindTolerance, int retries, string templatefilename = null, double threshold = -1)
        {
            while (retries-- > 0)
            {
                Global.DoBackgroundWork();
                //for (int i = 0; i < 3; i++) vp.GetMeasurementFrame(); //skip 10 frames
                Shapes.Thing thing = null;
                switch (type)
                {
                case Shapes.ShapeTypes.Circle:
                    thing = GetClosestCircle(vp, FindTolerance);
                    break;

                case Shapes.ShapeTypes.Fiducial:
                    var things = FindTemplates(vp, templatefilename, threshold);
                    thing = GetClosest(GetWithin(things, FindTolerance));
                    break;

                case Shapes.ShapeTypes.Rectangle:
                    thing = GetSmallestCenteredRectangle(FindRectangles(vp));
                    break;

                default:
                    Global.Instance.DisplayText("detection of " + type + " not yet supported", Color.Red);
                    break;
                }
                if (thing != null)
                {
                    return(thing);
                }
            }
            return(null);
        }
示例#2
0
 public PartLocation(Shapes.Thing thing)
 {
     X = thing.X; Y = thing.Y; A = thing.A;
 }