线段检测器类。 更多...
#include <opencv2/imgproc.hpp>
|
| virtual | ~LineSegmentDetector () |
| |
| virtual int | compareSegments (const Size &size, InputArray lines1, InputArray lines2, InputOutputArray image=noArray())=0 |
| | 用蓝色和红色绘制两组线条,并计算非重叠(不匹配)的像素。
|
| |
| virtual void | detect (InputArray image, OutputArray lines, OutputArray width=noArray(), OutputArray prec=noArray(), OutputArray nfa=noArray())=0 |
| | 在输入图像中查找线条。
|
| |
| virtual void | drawSegments (InputOutputArray image, InputArray lines)=0 |
| | 在给定图像上绘制线段。
|
| |
| | Algorithm () |
| |
| virtual | ~Algorithm () |
| |
| virtual void | clear () |
| | 清除算法状态。
|
| |
| virtual bool | empty () const |
| | 如果 Algorithm 为空(例如,在刚开始时或在读取失败后)则返回 true。
|
| |
| virtual String | getDefaultName () const |
| |
| virtual void | read (const FileNode &fn) |
| | 从文件存储中读取算法参数。
|
| |
| virtual void | save (const String &filename) const |
| |
| void | write (const Ptr< FileStorage > &fs, const String &name=String()) const |
| |
| virtual void | write (FileStorage &fs) const |
| | 将算法参数存储到文件存储中。
|
| |
| void | write (FileStorage &fs, const String &name) const |
| |
线段检测器类。
遵循 [112] 中描述的算法。
- 注意
- 由于原始代码许可证冲突,已从 OpenCV 版本 3.4.6 到 3.4.15 以及 4.1.0 到 4.5.3 中移除实现。 在 Computation of a NFA 代码在 MIT 许可证下发布后再次恢复。
◆ ~LineSegmentDetector()
| virtual cv::LineSegmentDetector::~LineSegmentDetector |
( |
| ) |
|
|
inlinevirtual |
◆ compareSegments()
| Python |
|---|
| cv.LineSegmentDetector.compareSegments( | size, lines1, lines2[, image] | ) -> | 返回值, image |
用蓝色和红色绘制两组线条,并计算非重叠(不匹配)的像素。
- 参数
-
| size | lines1 和 lines2 所在图像的大小。 |
| lines1 | 需要绘制的第一组线条。 它以蓝色可视化。 |
| lines2 | 第二组线条。 它们以红色可视化。 |
| image | 可选图像,线条将在其中绘制。 该图像应该是彩色(3 通道)的,以便 lines1 和 lines2 以上述颜色绘制。 |
◆ detect()
| Python |
|---|
| cv.LineSegmentDetector.detect( | image[, lines[, width[, prec[, nfa]]]] | ) -> | lines, width, prec, nfa |
在输入图像中查找线条。
这是上述图像上算法默认参数的输出。
image
- 参数
-
| image | 灰度 (CV_8UC1) 输入图像。 如果只需要选择一个 roi,请使用:lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y); |
| 输出向量,包含与另一图像中点对应的对极线。每条线\(ax + by + c=0\)由3个数字\((a, b, c)\)编码。 | Vec4f 元素的向量,指定线的起点和终点。 其中 Vec4f 为 (x1, y1, x2, y2),点 1 为起点,点 2 为终点。 返回的线条严格按照梯度方向定向。 |
| width | 找到线条的区域的宽度向量。 例如,线条宽度。 |
| prec | 找到线条的精度向量。 |
| nfa | 包含线区域中误报数量的向量,精度为 10%。 值越大,对数的检测效果越好。
- -1 对应于 10 个平均误报
- 0 对应于 1 个平均误报
- 1 对应于 0.1 个平均误报。 只有当对象类型为 LSD_REFINE_ADV 时才会计算此向量。
|
◆ drawSegments()
| Python |
|---|
| cv.LineSegmentDetector.drawSegments( | image, lines | ) -> | image |
在给定图像上绘制线段。
- 参数
-
| image | 将在其中绘制线条的图像。 应该大于或等于找到线条的图像。 |
| 输出向量,包含与另一图像中点对应的对极线。每条线\(ax + by + c=0\)由3个数字\((a, b, c)\)编码。 | 线条颜色。 |
此类文档由以下文件生成