Пример #1
0
        public ImageTracker(string name)
            : base()
        {
            Console.WriteLine("MyImage created");
            this.name = name;
            pushDetector = new PushDetector();
            circleDetector = new CircleDetector();
            circleDetector.MinimumPoints = 50;
            steadyDetector = new SteadyDetector();

            flowRouter = new FlowRouter();
            broadcaster = new Broadcaster();

            broadcaster.AddListener(pushDetector);
            broadcaster.AddListener(circleDetector);
            broadcaster.AddListener(flowRouter);

            pushDetector.Push += new EventHandler<VelocityAngleEventArgs>(pushDetector_Push);
            steadyDetector.Steady += new EventHandler<SteadyEventArgs>(steadyDetector_Steady);
            circleDetector.OnCircle += new EventHandler<CircleEventArgs>(circleDetector_OnCircle);

            PrimaryPointCreate += new EventHandler<HandFocusEventArgs>(MyBox_PrimaryPointCreate);
            PrimaryPointDestroy += new EventHandler<IdEventArgs>(MyBox_PrimaryPointDestroy);
            PrimaryPointUpdate += new EventHandler<HandEventArgs>(MyBox_PrimaryPointUpdate);
            OnUpdate += new EventHandler<UpdateMessageEventArgs>(MyBox_OnUpdate);
        }
Пример #2
0
        static void Main(string[] args)
        {
            string             path            = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName.ToString() + "\\error\\";
            int                estimatedRadius = 30;
            CircleF            circle;
            Image <Gray, Byte> img;
            CircleDetector     circleDetector = new CircleDetector();

            foreach (string file in Directory.EnumerateFiles(path, "*.jpg"))
            {
                string fileName = Path.GetFileName(file);
                img = new Image <Gray, Byte>(file);

                try
                {
                    var watch = System.Diagnostics.Stopwatch.StartNew();
                    circle = circleDetector.FindCircle(img, estimatedRadius: estimatedRadius, patternType: 1, error: 20);
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;
                    Console.WriteLine("\nFinished in " + elapsedMs + "ms");
                    img.Draw(circle, new Gray(0), 3);
                    Console.WriteLine("found circle with your estimated radius = " + estimatedRadius);
                    Console.WriteLine("[ " + circle.Center.ToString() + " , R = " + circle.Radius.ToString() + " ]");
                }
                catch (Exception e)
                {
                    //circle = new CircleF(new PointF(0, 0), 0);
                    Console.WriteLine("\nCannot find any circles with your estimated radius = " + estimatedRadius);
                }
                CvInvoke.Imshow("result", img);
                CvInvoke.WaitKey();
            }
        }
Пример #3
0
    public void TakeScreenShot()
    {
        //yield return new WaitForEndOfFrame();
        print("Called");

        Camera        camOV     = OVcamera.GetComponent <Camera>();
        RenderTexture currentRT = RenderTexture.active;

        RenderTexture.active = camOV.targetTexture;
        camOV.Render();
        Texture2D imageOverview = new Texture2D(camOV.targetTexture.width, camOV.targetTexture.height / 2, TextureFormat.RGB24, false);

        imageOverview.ReadPixels(new Rect(0, 0, camOV.targetTexture.width, camOV.targetTexture.height / 2), 0, 0);
        imageOverview.Apply();
        RenderTexture.active = currentRT;

        // Encode texture into PNG
        byte[] bytes = imageOverview.EncodeToPNG();

        // save in memory
        string filename = fileName(Convert.ToInt32(imageOverview.width), Convert.ToInt32(imageOverview.height));

        //path = Application.persistentDataPath + "/Snapshots/" + filename;
        path = "C:/Users/Chroma/CHROMA/Snapshots/" + filename;
        System.IO.File.WriteAllBytes(path, bytes);

        CircleDetector.CallFunction();
    }
Пример #4
0
 /// <summary>
 /// 检查环形依赖
 /// </summary>
 private void CheckCircleImplement()
 {
     foreach (var relation in this.typeRelations)
     {
         var detector = new CircleDetector(relation);
         detector.Detect();
     }
 }
Пример #5
0

        
Пример #6
0
 private void Awake()
 {
     detector       = GetComponent <CircleDetector>();
     tailleModifier = GetComponent <TailleModifier>();
 }