compareSegments method

(int, Mat) compareSegments(
  1. InputArray image,
  2. (int, int) size,
  3. VecVec4f lines1,
  4. VecVec4f lines2, {
  5. Mat? imageOut,
})

Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.

Parameters - size The size of the image, where lines1 and lines2 were found. - lines1 The first group of lines that needs to be drawn. It is visualized in blue color. - lines2 The second group of lines. They visualized in red color. - image Optional image, where the lines will be drawn. The image should be color(3-channel) in order for lines1 and lines2 to be drawn in the above mentioned colors.

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

Implementation

(int rval, Mat imageOut) compareSegments(
  InputArray image,
  (int, int) size,
  VecVec4f lines1,
  VecVec4f lines2, {
  Mat? imageOut,
}) {
  imageOut ??= Mat.empty();
  final sz = size.toSize();
  final prval = calloc<ffi.Int>();
  cvRun(
    () => cimgproc.cv_LineSegmentDetector_compareSegments(
      ref,
      sz.ref,
      lines1.ref,
      lines2.ref,
      imageOut!.ref,
      prval,
      ffi.nullptr,
    ),
  );
  final rval = (prval.value, imageOut);
  calloc.free(prval);
  sz.dispose();
  return rval;
}