OpenCV HoughLinesP如何检测线是相交?

我试图让OpenCV检测我的纸张图像的角落。 到目前为止,我能够检测到边缘,HoughLinesP能够检测到我的线条,我想。 我的代码如下:

Imgproc.HoughLinesP(matDrawing, matLines, 1.0, Math.PI / 180, 70, 30.0, 10.0) val arrayListCorners = ArrayList() for (i in 0 until matLines.rows()) { for (j in i + 1 until matLines.rows()) { val arrayLine1 = matLines.get(i, 0) val arrayLine2 = matLines.get(j, 0) // Detect if arrayLine1 and arrayLine2 did intersect? } } 

我需要帮助,如果我怎么能检测两条线是否相交。 我需要我的arrayListCorners正好返回4,以便能够在代码的后面部分传递条件。

我正在使用Kotlin。 Java代码很好。 我是OpenCV的新手,到目前为止我只理解基础知识。 我在这里先向您的帮助表示感谢。