using System; using System.Collections.Generic; using System.Text; namespace YOLODetectProcessLib { /// /// 矩形框,代替System.Drawing.Rectangle /// public struct Rect { public int Left { get; set; } public int Top { get; set; } public int Right { get; set; } public int Bottom { get; set; } public int Width { get; set; } public int Height { get; set; } public Rect(int left, int top, int width, int height) { if (width < 0) { throw new ArgumentException("width", "Width should be greater than 0."); } if (height < 0) { throw new ArgumentException("height", "Height should be greater than 0"); } Left = left; Top = top; Right = left + width; Bottom = top + height; Width = width; Height = height; } public bool IsEmpty() { return (Left == 0) && (Right == 0) && (Top == 0) && (Bottom == 0); } public static readonly Rect Empty; } }