public void GetRingParameters() { Image <Gray, Byte> inputRing = new Image <Gray, byte>(Globals.whiteBmp); AOIrectangle = new Rectangle((int)Globals.nvramHelper.GetNvramValue(Nvram.NvramHelper.RoyalSettings.AOIRectangleX), (int)Globals.nvramHelper.GetNvramValue(Nvram.NvramHelper.RoyalSettings.AOIRectangleY), 960, 960); inputRing.ROI = AOIrectangle; rc.rc = RefractoCalculations.GetInstance(); try { ellipse = rc.rc.CalculateRing(inputRing.Convert <Gray, byte>()); } catch (Exception ex) { MessageBox.Show("Please check if the calibration jig is attched"); } }
private void DoRingCalculations() { this.Cursor = Cursors.WaitCursor; //Calculate ring and show rc = RefractoCalculations.GetInstance(); inputRing = new Image <Bgr, byte>(Globals.whiteBmp); forDrawing = inputRing.Copy(); ellipse = rc.CalculateRing(inputRing.Convert <Gray, byte>()); forDrawing = rc.drawEllipse(forDrawing, ellipse, new Bgr(0, 0, 255), 1); overlay = forDrawing; rc.ComputeFullRingThickness(); rc.ComputeRadii(); Sharpness = rc.GetRingSharpness(); showRingDetails(); Args arg = new Args(); Globals.whiteBmp = forDrawing.ToBitmap(); forDrawing.Dispose(); f.Publish(f.displayImage, arg); // = forDrawing.ToBitmap(); this.Cursor = Cursors.Default; }