/// <summary> /// Constructor for this class /// </summary> /// <param name="camera"> /// this gives us the camera object which we use to get images from /// </param> public TrayDetectorVision(Camera camera) { this.camera = camera; Debug.Listeners.Add(listener); // Pull the HSV color ranges from our camera this.HSVTabletcolorsRanges = camera.HSVColorRanges; minRadius = camera.MinRadius; maxRadius = camera.MaxRadius; dp = camera.Dp; minDist = camera.MinDist; cannyThresh = camera.CannyThresh; cannyAccumThresh = camera.CannyAccumThresh; HSVDetectionThreshold = camera.HSVDetectionThreshold; //this.camera.ConnectionString = new Uri(@"http://192.168.0.190:8080/photoaf.jpg"); //this.camera.ConnectionString = new Uri(@"https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-ash3/t1.0-9/10247212_10202692742692192_8562559696417032763_n.jpg"); }
/// <summary> /// constructor for sorter vision, do all initilasation here /// </summary> /// <param name="camera"> /// camera object we use to get images off /// </param> public SorterVision(Camera camera) { this.camera = camera; Debug.Listeners.Add(listener); // Pull the HSV color ranges from our camera this.HSVTabletcolorsRanges = camera.HSVColorRanges; minRadius = camera.MinRadius; maxRadius = camera.MaxRadius; dp = camera.Dp; minDist = camera.MinDist; cannyThresh = camera.CannyThresh; cannyAccumThresh = camera.CannyAccumThresh; HSVDetectionThreshold = camera.HSVDetectionThreshold; this.Register(); }
private static void TestCamera() { Camera trayC = new Camera(); trayC.ConnectionString = new Uri(@"http://192.168.1.8:8080/photoaf.jpg"); Camera sort = new Camera(); sort.ConnectionString = new Uri(@"http://192.168.1.19:8080/photoaf.jpg"); //c.SetParameters(new Dictionary<string, string> { { "Name", "TestCam1" }, { "ConnectionString", "http://192.168.0.11:8080/photo.jpg" } });//"http://192.168.0.11:8080/photo.jpg" trayC.Initialise(); //sort.Initialise(); /* TrayDetectorVision tray = new TrayDetectorVision(trayC); while (true) { Tray<Tablet> Tray = new Tray<Tablet>(); bool colr = tray.GetTabletsInTray(out Tray); }*/ SorterVision sorter = new SorterVision(sort); sorter.Calibrate(); while (true) { List<Tablet> tabletList = sorter.GetVisibleTablets(); } //CvInvoke.cvWaitKey(0); }