New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opencv.js/utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencv.js/utils - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

28

package.json
{
"name": "@opencv.js/utils",
"description": "opencv.js utils",
"version": "1.0.0",
"author": "morozovsk (https://github.com/morozovsk)",
"version": "1.1.0",
"author": {
"name": "morozovsk",
"url": "https://github.com/morozovsk"
},
"homepage": "https://github.com/opencv-js",
"repository": {
"type": "git",
"url": "git+https://github.com/opencv-js/utils.git"
"url": "https://github.com/opencv-js/utils.git"
},
"keywords": [
"opencv",
"opencvjs",
"opencv.js",
"utils",
"dev",
"debug",
"error",
"exception"
],
"keywords": ["opencv", "opencvjs", "opencv.js", "utils", "dev", "debug", "error", "exception"],
"license": "MIT",
"main": "utils.js",
"bugs": {
"url": "https://github.com/opencv-js/utils/issues"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
"main": "utils.js"
}

@@ -1,2 +0,11 @@

exports.printError = function(err) {
// C1 C2 C3 C4 C++ JavaScript
// CV_8U 0 8 16 24 uchar Uint8Array ( 0..255 )
// CV_8S 1 9 17 25 char Int8Array ( -128..127 )
// CV_16U 2 10 18 26 ushort Uint16Array ( 0..65535 )
// CV_16S 3 11 19 27 short Int16Array ( -32768..32767 )
// CV_32S 4 12 20 28 int Int32Array ( -2147483648..2147483647 )
// CV_32F 5 13 21 29 float Float32Array ( -FLT_MAX..FLT_MAX, INF, NAN )
// CV_64F 6 14 22 30 double Float64Array ( -DBL_MAX..DBL_MAX, INF, NAN )
exports.printError = function (err) {
if (typeof err === 'undefined') {

@@ -23,3 +32,72 @@ err = '';

exports.printMat = function (mat) {
console.log({step: mat.step, elemSize: mat.elemSize(), matSize: mat.matSize, sizes: mat.size(), empty: mat.empty(), depth: mat.depth(), dims: mat.dims, channels: mat.channels(), type: mat.type(), cols: mat.cols, rows: mat.rows});
console.log(this.matInfo(mat));
}
exports.matInfo = function (mat) {
return {
_matType: this.matType(mat),
_depth: mat.depth(),
matSize: mat.matSize,
_channels: mat.channels(),
_size: mat.size(),
_cols: mat.cols,
_rows: mat.rows,
//dims: mat.dims,
_type: mat.type(),
_elemSize: mat.elemSize(),
_step: mat.step,
//_empty: mat.empty(),
_data: this.matData(mat)
}
}
exports.matType = function (mat) {
let types = [
'CV_8UC1', 'CV_8SC1', 'CV_16UC1', 'CV_16SC1', 'CV_32SC1', 'CV_32FC1', 'CV_64FC1',
'CV_8UC2', 'CV_8SC2', 'CV_16UC2', 'CV_16SC2', 'CV_32SC2', 'CV_32FC2', 'CV_64FC2',
'CV_8UC3', 'CV_8SC3', 'CV_16UC3', 'CV_16SC3', 'CV_32SC3', 'CV_32FC3', 'CV_64FC3',
'CV_8UC4', 'CV_8SC4', 'CV_16UC4', 'CV_16SC4', 'CV_32SC4', 'CV_32FC4', 'CV_64FC4'
];
return types[mat.type()];
}
exports.matData = function (mat) {
let data;
switch (mat.type() % 7) {
case 0: // CV_8U
data = mat.data;
break;
case 1: // CV_8S
data = mat.data8S;
break;
case 2: // CV_16U
data = mat.data16U;
break;
case 3: // CV_16S
data = mat.data16S;
break;
case 4: // CV_32S
data = mat.data32S;
break;
case 5: // CV_32F
data = mat.data32F;
break;
case 6: // CV_64F
data = mat.data64F;
break;
default:
data = mat.data;
}
return data;
}
exports.matAtIdx = function (mat, idx) {
let ptr = 0;
for (let i = 0; i < idx.length; i++) {
ptr += idx[i] * mat.step[i] / mat.elemSize();
}
return this.matData(mat)[ptr];
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc