ImageEn, unit ievision




function houghLinesP(rho: double; theta: double; threshold: int32_t; minLineLength: double = 0; maxLineGap: double = 0): TIEVisionVectorScalarInt32; safecall;


Finds line segments in a binary image using the probabilistic Hough transform.
Returns a vector of line segments. Each line is represented by a 4-element vector (x1, y1, x2, y2), where (x1, y1) and (x2, y2) are the ending points of each detected line segment.

Note: Pixel format of input image must be ie8g.

Parameter Description
rho Distance resolution of the accumulator in pixels.
theta Angle resolution of the accumulator in radians.
threshold Accumulator threshold parameter. Only those lines are returned that get enough votes.
minLineLength Minimum line length. Line segments shorter than that are rejected.
maxLineGap Maximum allowed gap between points on the same line to link them.


  lines: TIEVisionVectorScalarInt32;
  i: integer;
  ImageEnView.IEBitmap.PixelFormat := ie8g;
  ImageEnView.IEBitmap.GetIEVisionImage().blur(IEVisionSize(3, 3), IEVisionPoint(-1, -1));
  ImageEnView.IEBitmap.GetIEVisionImage().canny(50, 200, 3);
  lines := ImageEnView.IEBitmap.GetIEVisionImage().houghLinesP(1, PI / 180, 200, 100, 10);
  // draw results
  ImageEnView.IEBitmap.PixelFormat := ie24RGB;
  ImageEnView.IEBitmap.Origin := ieboBOTTOMLEFT;
  for i := 0 to lines.size() - 1 do
    with lines.getScalarInt32(i) do
      with ImageEnView.IEBitmap.Canvas do
        Pen.Color := clRed;
        MoveTo(val[0], val[1]);
        LineTo(val[2], val[3]);