码迷,mamicode.com
首页 > Web开发 > 详细

【opencv.js】访问单个像素

时间:2020-04-24 01:14:19      阅读:103      评论:0      收藏:0      [点我收藏+]

标签: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 TypeAt 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 TypePtr ManipulationJavaScript 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];

 

【opencv.js】访问单个像素

标签:java   ann   open   c++   target   opencv   mat   arp   canvas   

原文地址:https://www.cnblogs.com/bjxqmy/p/12764716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!