Exemplo n.º 1
0
        private static bool ValidateRow(Rectangle area, List <Rectangle> offsetList)
        {
            //横向的,上下0.4个宽度,左右大于0.8个高度度即可
            bool isValidate = true;

            var averageWidth  = offsetList.Average(r => r.Width);
            var averageHeight = offsetList.Average(r => r.Height);
            var maxRect       = CVHelper.GetMaxRect(offsetList);


            if (maxRect.X < 0.4 * averageWidth || maxRect.X + maxRect.Width + 0.4 * averageWidth > area.Width ||
                maxRect.Y < 0.8 * averageHeight || maxRect.Y + maxRect.Height + 0.8 * averageHeight > area.Height)
            {
                return(false);
            }



            return(isValidate);
        }
Exemplo n.º 2
0
        private static bool ValidateColumn(Rectangle area, List <Rectangle> offsetList)
        {
            /// 偏移量区域,规范,最高线和最低线距离最近的偏移测量点大于1.5个偏移高度
            /// 左右距离需要大于0.6个偏移点宽度
            bool isValidate = true;


            var averageWidth  = offsetList.Average(r => r.Width);
            var averageHeight = offsetList.Average(r => r.Height);
            var maxRect       = CVHelper.GetMaxRect(offsetList);

            if (averageWidth * 0.6 > maxRect.X || area.Width - averageWidth * 0.6 < maxRect.X + maxRect.Width ||
                averageHeight * 1.5 > maxRect.Y || area.Height < maxRect.Y + maxRect.Height + averageHeight * 1.5)
            {
                return(false);
            }


            return(isValidate);
        }