detect method

(VecVec4f, VecF64, VecF64, VecF64) detect(
  1. InputArray image, {
  2. VecVec4f? lines,
  3. VecF64? width,
  4. VecF64? prec,
  5. VecF64? nfa,
})

Finds lines in the input image.

Parameters

  • image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);

  • lines A vector of Vec4f elements specifying the beginning and ending point of a line. Where Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient.

  • width Vector of widths of the regions, where the lines are found. E.g. Width of line.

  • prec Vector of precisions with which the lines are found.

  • nfa Vector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection.

    -1 corresponds to 10 mean false alarms 0 corresponds to 1 mean false alarm 1 corresponds to 0.1 mean false alarms This vector will be calculated only when the objects type is LSD_REFINE_ADV.

https://docs.opencv.org/4.x/db/d73/classcv_1_1LineSegmentDetector.html#acb0cbd33bb3fbcd29a68309850da82fd

Implementation

(VecVec4f lines, VecF64 width, VecF64 prec, VecF64 nfa) detect(
  InputArray image, {
  VecVec4f? lines,
  VecF64? width,
  VecF64? prec,
  VecF64? nfa,
}) {
  lines ??= VecVec4f(); // caller is still responsible for dispose-ing these values
  width ??= VecF64();
  prec ??= VecF64();
  nfa ??= VecF64();

  cvRun(
    () => cimgproc.cv_LineSegmentDetector_detect(
      ref,
      image.ref,
      lines!.ref,
      width!.ref,
      prec!.ref,
      nfa!.ref,
      ffi.nullptr,
    ),
  );
  final rval = (lines, width, prec, nfa);
  return rval;
}