public double VerticalDistance(OCVLineData line2) { if (this.IsHorizontal() && line2.IsHorizontal()) { return(Math.Abs(GetY() - line2.GetY())); } else { return(-1); } }
protected override double GetLocation(OCVLineData line) { return(line.GetY()); }
public OCVGridDefinition Analyze(double threshold) { double left = OCVConst.REALLYLARGE, top = OCVConst.REALLYLARGE, right = -OCVConst.REALLYLARGE, bottom = -OCVConst.REALLYLARGE; // remove lines that are too small RemoveSmallLines(threshold); // analyze horizontal lines int rows = -1; foreach (OCVCombinedLinesData linesGroup in HorizontalLines) { rows++; OCVLineData summaryLine = linesGroup.GetSummaryLine(); if (summaryLine.GetMinValue() < left) { left = summaryLine.GetMinValue(); } if (summaryLine.GetMaxValue() > right) { right = summaryLine.GetMaxValue(); } if (summaryLine.GetY() > top) { top = summaryLine.GetY(); } if (summaryLine.GetY() < bottom) { bottom = summaryLine.GetY(); } } // analyze vertical lines int cols = -1; foreach (OCVCombinedLinesData linesGroup in VerticalLines) { cols++; OCVLineData summaryLine = linesGroup.GetSummaryLine(); if (summaryLine.GetX() < left) { left = summaryLine.GetX(); } if (summaryLine.GetX() > right) { right = summaryLine.GetX(); } if (summaryLine.GetMinValue() < top) { top = summaryLine.GetMinValue(); } if (summaryLine.GetMaxValue() > bottom) { bottom = summaryLine.GetMaxValue(); } } OCVGridDefinition result = new OCVGridDefinition(new Point((int)left, (int)top), new Point((int)right, (int)bottom), rows, cols ); return(result); }