1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

fix the perf tests of OpenCV.js so that it can run on Node.js successfully

This commit is contained in:
lionkun
2021-03-24 16:34:22 +08:00
committed by Alexander Alekhin
parent bf03f5fa3a
commit 8d232a63ad
17 changed files with 84 additions and 17 deletions
+8 -1
View File
@@ -1,3 +1,10 @@
const isNodeJs = (typeof window) === 'undefined'? true : false;
if(isNodeJs) {
var Base = require("./base");
global.getCvSize = Base.getCvSize;
}
var fillGradient = function(cv, img, delta=5) {
let ch = img.channels();
console.assert(!img.empty() && img.depth() == cv.CV_8U && ch <= 4);
@@ -56,8 +63,8 @@ var smoothBorder = function(cv, img, color, delta=5) {
var cvtStr2cvSize = function(strSize) {
let size;
let cvSize = getCvSize();
switch(strSize) {
case "127,61": size = cvSize.szODD;break;
case '320,240': size = cvSize.szQVGA;break;