本文整理汇总了C++中zxing::Line方法的典型用法代码示例。如果您正苦于以下问题:C++ zxing::Line方法的具体用法?C++ zxing::Line怎么用?C++ zxing::Line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zxing
的用法示例。
在下文中一共展示了zxing::Line方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findCrossingPoint
/**
* <p>Finds the intersection of two lines.</p>
*
* @param vertices The reference of the vertices vector
* @param idxResult Index of result point inside the vertices vector.
* @param idxLineA1
* @param idxLineA2 Indices two points inside the vertices vector that define the first line.
* @param idxLineB1
* @param idxLineB2 Indices two points inside the vertices vector that define the second line.
* @param matrix: bit matrix, here only for testing whether the result is inside the matrix.
* @return Returns true when the result is valid and lies inside the matrix. Otherwise throws an
* exception.
**/
void Detector::findCrossingPoint(ArrayRef< Ref<ResultPoint> >& vertices,
int idxResult,
int idxLineA1, int idxLineA2,
int idxLineB1, int idxLineB2,
Ref<BitMatrix>& matrix)
{
Point p1(vertices[idxLineA1]->getX(), vertices[idxLineA1]->getY());
Point p2(vertices[idxLineA2]->getX(), vertices[idxLineA2]->getY());
Point p3(vertices[idxLineB1]->getX(), vertices[idxLineB1]->getY());
Point p4(vertices[idxLineB2]->getX(), vertices[idxLineB2]->getY());
Point result(intersection(Line(p1, p2), Line(p3, p4)));
if (result.x == numeric_limits<float>::infinity() ||
result.y == numeric_limits<float>::infinity()) {
throw NotFoundException("PDF:Detector: cannot find the crossing of parallel lines!");
}
int x = Math::round(result.x);
int y = Math::round(result.y);
if (x < 0 || x >= (int)matrix->getWidth() || y < 0 || y >= (int)matrix->getHeight()) {
throw NotFoundException("PDF:Detector: crossing points out of region!");
}
vertices[idxResult] = Ref<ResultPoint>(new ResultPoint(result.x, result.y));
}