标签:java ann open c++ target opencv mat arp canvas
JavaScript 写法类似于 C++ 写法。
相关内容详细介绍请移步官网:【https://docs.opencv.org/3.3.1/de/d06/tutorial_js_basic_ops.html】
at 方法
Mat Type | At Manipulation |
---|---|
CV_8U | ucharAt |
CV_8S | charAt |
CV_16U | ushortAt |
CV_16S | shortAt |
CV_32S | intAt |
CV_32F | floatAt |
CV_64F | doubleAt |
//访问(3,4)位置上的像素
let row = 3, col = 4;
let src = cv.imread("canvasInput");
let R = src.ucharAt(row, col * src.channels());
let G = src.ucharAt(row, col * src.channels() + 1);
let B = src.ucharAt(row, col * src.channels() + 2);
let A = src.ucharAt(row, col * src.channels() + 3);
ptr 方法
Mat Type | Ptr Manipulation | JavaScript Typed Array |
---|---|---|
CV_8U | ucharPtr | Uint8Array |
CV_8S | charPtr | Int8Array |
CV_16U | ushortPtr | Uint16Array |
CV_16S | shortPtr | Int16Array |
CV_32S | intPtr | Int32Array |
CV_32F | floatPtr | Float32Array |
CV_64F | doublePtr | Float64Array |
//访问(3,4)位置上的像素
let row = 3, col = 4;
let src = cv.imread("canvasInput");
let pixel = src.ucharPtr(row, col);
let R = pixel[0];
let G = pixel[1];
let B = pixel[2];
let A = pixel[3];
标签:java ann open c++ target opencv mat arp canvas
原文地址:https://www.cnblogs.com/bjxqmy/p/12764716.html