selectROI function

Rect selectROI(
  1. String winName,
  2. Mat img, {
  3. bool showCrosshair = true,
  4. bool fromCenter = false,
  5. bool printNotice = true,
})

SelectROI selects a Region Of Interest (ROI) on the given image. It creates a window and allows user to select a ROI cvRunArena mouse.

Controls: use space or enter to finish selection, use key c to cancel selection (function will return a zero Rect).

For further details, please see: https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga8daf4730d3adf7035b6de9be4c469af5

Implementation

Rect selectROI(
  String winName,
  Mat img, {
  bool showCrosshair = true,
  bool fromCenter = false,
  bool printNotice = true,
}) {
  final cWinName = winName.toNativeUtf8().cast<ffi.Char>();
  final p = calloc<cvg.CvRect>();
  cvRun(() => chighgui.cv_selectROI(cWinName, img.ref, showCrosshair, fromCenter, printNotice, p));
  calloc.free(cWinName);
  return Rect.fromPointer(p);
}