How are two-element vector represented in a OpenCV Mat in Java?

后端 未结 1 1522
慢半拍i
慢半拍i 2020-12-18 04:17

I was looking at Opencv Java documentation of Hough Transform.

The return value lines is in a Mat data type described as:

相关标签:
1条回答
  • 2020-12-18 04:59

    Here's some code I used a while ago, in version 2.4.8 I think. matLines came from this:

    Imgproc.HoughLinesP(matOutline, matLines, 1, Math.PI / 180, houghThreshCurrent, houghMinLength, houghMaxGap);
    

    ...

    Point[] points = new Point[]{ new Point(), new Point() };
    for (int x = 0; x < matLines.cols(); x++) {
       double[] vec = matLines.get(0, x);
       points[0].x = vec[0];
       points[0].y = vec[1];
       points[1].x = vec[2];
       points[1].y = vec[3];
       //...
    }
    
    0 讨论(0)
提交回复
热议问题