internal void Show(EfficientTipAndPERdetector.TipAndPERResult processorResult) { if (processorResult?.Left?.Tip != null) { leftLine.X1 = processorResult.Left.Tip.StandardPoint.X; leftLine.Y1 = processorResult.Left.Tip.StandardPoint.Y; leftLine.X2 = processorResult.Left.Base.StandardPoint.X; leftLine.Y2 = processorResult.Left.Base.StandardPoint.Y; leftAngle.Content = processorResult.Left.Angle.ToString("N0") + "°"; } if (processorResult?.Right?.Tip != null) { rightLine.X1 = processorResult.Right.Tip.StandardPoint.X; rightLine.Y1 = processorResult.Right.Tip.StandardPoint.Y; rightLine.X2 = processorResult.Right.Base.StandardPoint.X; rightLine.Y2 = processorResult.Right.Base.StandardPoint.Y; rightAngle.Content = (-processorResult.Right.Angle).ToString("N0") + "°"; } if (processorResult?.Proboscis != null) { prob.X2 = processorResult.Proboscis.Tip.StandardPoint.X; prob.Y2 = processorResult.Proboscis.Tip.StandardPoint.Y; probLength.Content = 100 - 4 * processorResult.Proboscis.Tip.StandardPoint.Y; } }
internal void Show(EfficientTipAndPERdetector.TipAndPERResult processorResult) { var width = (int)image.Width; var height = (int)image.Height; //Create WriteableBitmap the first time if (canvasBuffer == null) { clearFrame = new Frame(width, height); canvasBuffer = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgr24, null); image.Source = canvasBuffer; } using (var gfx = Graphics.FromImage(clearFrame.Bitmap)) { gfx.Clear(Color.White); } if (processorResult?.Left?.SectorCounts != null) { clearFrame.MarkSectors( sectors: processorResult.Left.SectorCounts, headCtrX: width / 2, headCtrY: height / 2, headHeight: height / 2, headAngle: 0, color: Color.Black, isRight: false ); leftDomSec.Content = processorResult.Left.DominantSector; leftSecMode.Content = processorResult.Left.TopAngle + "°"; } else { leftDomSec.Content = "-"; leftSecMode.Content = "-"; } if (processorResult?.Right?.SectorCounts != null) { clearFrame.MarkSectors( sectors: processorResult.Right.SectorCounts, headCtrX: width / 2, headCtrY: height / 2, headHeight: height / 2, headAngle: 0, color: Color.Black, isRight: true ); rightDomSec.Content = processorResult.Right.DominantSector; rightSecMode.Content = processorResult.Right.TopAngle + "°"; } else { rightDomSec.Content = "-"; rightSecMode.Content = "-"; } clearFrame.CopyToWriteableBitmap(canvasBuffer); }