@autojs/opencv — OpenCV
10/22/22Less than 1 minute
Auto.js Pro 9 bundles @autojs/opencv as a built-in module (successor to opencv4nodejs). Use it like the upstream package—no npm install is required inside typical script projects.
Core types you will touch most often include Mat, Rect, Point, and friends.
Further reading
- OpenCV 4.5.1 docs and
cv::Mat - @autojs/opencv Quick Start
- Legacy opencv4nodejs Mat reference (API shape is very similar)
OpenCV itself is huge—this documentation site does not mirror the full OpenCV manual. Treat the links above as the source of truth.
Example
"nodejs";
const cv = require("@autojs/opencv");
const rows = 100; // height
const cols = 100; // width
const emptyMat = new cv.Mat(rows, cols, cv.CV_8UC3);
// fill the Mat with default value
const whiteMat = new cv.Mat(rows, cols, cv.CV_8UC1, 255);
const blueMat = new cv.Mat(rows, cols, cv.CV_8UC3, [255, 0, 0]);