类 LineSegmentDetector
- java.lang.Object
-
- org.opencv.core.Algorithm
-
- org.opencv.imgproc.LineSegmentDetector
-
public class LineSegmentDetector extends Algorithm
线段检测器类,遵循 CITE: Rafael12 中描述的算法。注意:由于原始代码许可证冲突,该实现已从 OpenCV 3.4.6 至 3.4.15 版本和 4.1.0 至 4.5.3 版本中移除。在 [计算 NFA](https://github.com/rafael-grompone-von-gioi/binomial_nfa) 代码以 MIT 许可证发布后,再次恢复。
-
-
构造函数摘要
构造函数 修饰符 构造函数 描述 protectedLineSegmentDetector(long addr)
-
方法摘要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 描述 static LineSegmentDetector__fromPtr__(long addr)intcompareSegments(Size size, Mat lines1, Mat lines2)绘制两组线段,分别为蓝色和红色,并计算非重叠(不匹配)像素的数量。intcompareSegments(Size size, Mat lines1, Mat lines2, Mat image)绘制两组线段,分别为蓝色和红色,并计算非重叠(不匹配)像素的数量。voiddetect(Mat image, Mat lines)在输入图像中查找线段。voiddetect(Mat image, Mat lines, Mat width)在输入图像中查找线段。voiddetect(Mat image, Mat lines, Mat width, Mat prec)在输入图像中查找线段。voiddetect(Mat image, Mat lines, Mat width, Mat prec, Mat nfa)在输入图像中查找线段。voiddrawSegments(Mat image, Mat lines)在给定图像上绘制线段。protected voidfinalize()-
从类 org.opencv.core.Algorithm继承的方法
clear, empty, getDefaultName, getNativeObjAddr, save
-
-
-
-
方法详情
-
__fromPtr__
public static LineSegmentDetector __fromPtr__(long addr)
-
detect
public void detect(Mat image, Mat lines, Mat width, Mat prec, Mat nfa)
在输入图像中查找线段。这是该算法的默认参数在上面显示的图像上的输出。- 参数
image- 灰度 (CV_8UC1) 输入图像。如果只需要选择 roi,请使用:lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);lines- Vec4f 元素向量,指定线段的起点和终点。其中 Vec4f 为 (x1, y1, x2, y2),点 1 为起点,点 2 为终点。返回的线段严格按照梯度方向排列。width- 线段所在区域的宽度向量。例如,线段的宽度。prec- 找到线段的精度向量。nfa- 包含线段区域中误报数量的向量,精度为 10%。值越大,检测结果越好(对数关系)。- -1 对应于 10 个平均误报
- 0 对应于 1 个平均误报
- 1 对应于 0.1 个平均误报 只有当对象的类型为 #LSD_REFINE_ADV 时,才会计算此向量。
-
detect
public void detect(Mat image, Mat lines, Mat width, Mat prec)
在输入图像中查找线段。这是该算法的默认参数在上面显示的图像上的输出。- 参数
image- 灰度 (CV_8UC1) 输入图像。如果只需要选择 roi,请使用:lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);lines- Vec4f 元素向量,指定线段的起点和终点。其中 Vec4f 为 (x1, y1, x2, y2),点 1 为起点,点 2 为终点。返回的线段严格按照梯度方向排列。width- 线段所在区域的宽度向量。例如,线段的宽度。prec- 找到线段的精度向量。值越大,检测结果越好(对数关系)。- -1 对应于 10 个平均误报
- 0 对应于 1 个平均误报
- 1 对应于 0.1 个平均误报 只有当对象的类型为 #LSD_REFINE_ADV 时,才会计算此向量。
-
detect
public void detect(Mat image, Mat lines, Mat width)
在输入图像中查找线段。这是该算法的默认参数在上面显示的图像上的输出。- 参数
image- 灰度 (CV_8UC1) 输入图像。如果只需要选择 roi,请使用:lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);lines- Vec4f 元素向量,指定线段的起点和终点。其中 Vec4f 为 (x1, y1, x2, y2),点 1 为起点,点 2 为终点。返回的线段严格按照梯度方向排列。width- 线段所在区域的宽度向量。例如,线段的宽度。值越大,检测结果越好(对数关系)。- -1 对应于 10 个平均误报
- 0 对应于 1 个平均误报
- 1 对应于 0.1 个平均误报 只有当对象的类型为 #LSD_REFINE_ADV 时,才会计算此向量。
-
detect
public void detect(Mat image, Mat lines)
在输入图像中查找线段。这是该算法的默认参数在上面显示的图像上的输出。- 参数
image- 灰度 (CV_8UC1) 输入图像。如果只需要选择 roi,请使用:lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);lines- Vec4f 元素向量,指定线段的起点和终点。其中 Vec4f 为 (x1, y1, x2, y2),点 1 为起点,点 2 为终点。返回的线段严格按照梯度方向排列。值越大,检测结果越好(对数关系)。- -1 对应于 10 个平均误报
- 0 对应于 1 个平均误报
- 1 对应于 0.1 个平均误报 只有当对象的类型为 #LSD_REFINE_ADV 时,才会计算此向量。
-
drawSegments
public void drawSegments(Mat image, Mat lines)
在给定图像上绘制线段。- 参数
image- 将绘制线段的图像。应大于或等于找到线段的图像。lines- 需要绘制的线段向量。
-
compareSegments
public int compareSegments(Size size, Mat lines1, Mat lines2, Mat image)
绘制两组线段,分别为蓝色和红色,并计算非重叠(不匹配)像素的数量。- 参数
size- lines1 和 lines2 所在图像的大小。lines1- 需要绘制的第一组线段。以蓝色显示。lines2- 第二组线段。以红色显示。image- 可选图像,将在其中绘制线段。图像应为彩色(3 通道)图像,以便将 lines1 和 lines2 以上述颜色绘制。- 返回
- 自动生成
-
compareSegments
public int compareSegments(Size size, Mat lines1, Mat lines2)
绘制两组线段,分别为蓝色和红色,并计算非重叠(不匹配)像素的数量。- 参数
size- lines1 和 lines2 所在图像的大小。lines1- 需要绘制的第一组线段。以蓝色显示。lines2- 第二组线段。以红色显示。以便将 lines1 和 lines2 以上述颜色绘制。- 返回
- 自动生成
-
-