BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.22k stars 4.62k forks source link

How to use lineArray returned in linesDetectedBlock GPUImageHoughLineDetection #2486

Closed taixhi closed 7 years ago

taixhi commented 7 years ago

I would like to use the lines detected through the HoughLineDetection operation. However, I can't seem to figure how the array is structured. I need the normalized m and c of y=mx+c but lineDetected is an array? The below code returns bunch of numbers in the range of -1 to 1 but I have no clue how to convert them to m and c pair arrays like [0.2, 0.3]

      for i in 0...Int(linesDetected){
          print(lineArray?[i])
      }

Would be great to hear back from you.

BradLarson commented 7 years ago

The array you get in that callback contains normalized slopes and Y-intercepts in pairs. ([slope, intercept, slope, intercept, etc.]). The linesDetected parameter tells you how large that array is, in pairs.