当前位置: 首页>>代码示例>>C++>>正文


C++ zxing::Line方法代码示例

本文整理汇总了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));
}
开发者ID:ComputerVisionWorks,项目名称:QZXing,代码行数:38,代码来源:PDF417Detector.cpp


注:本文中的zxing::Line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。