How to use the opencv4nodejs-prebuilt.Rect function in opencv4nodejs-prebuilt

To help you get started, we’ve selected a few opencv4nodejs-prebuilt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nut-tree / nut.js / lib / provider / opencv / image-processor.class.ts View on Github external
function determineROI(img: Image, roi: Region): cv.Rect {
  return new cv.Rect(
    Math.min(Math.max(roi.left, 0), img.width),
    Math.min(Math.max(roi.top, 0), img.height),
    Math.min(roi.width, img.width - roi.left),
    Math.min(roi.height, img.height - roi.top));
}