if (typeof window === 'undefined') {
var cv = require("../opencv");
+ if (cv instanceof Promise) {
+ loadOpenCV();
+ } else {
+ cv.onRuntimeInitialized = perf;
+ }
}
let gCvSize;
return gCvSize;
}
+async function loadOpenCV() {
+ cv = await cv;
+}
+
if (typeof window === 'undefined') {
exports.getCvSize = getCvSize;
}
\ No newline at end of file
+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);
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;
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.constructMode = HelpFunc.constructMode;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
}
let totalCaseNum, currentCaseId;
- //extra color conversions supported implicitly
+ // extra color conversions supported implicitly
{
cv.CX_BGRA2HLS = cv.COLOR_COLORCVT_MAX + cv.COLOR_BGR2HLS,
cv.CX_BGRA2HLS_FULL = cv.COLOR_COLORCVT_MAX + cv.COLOR_BGR2HLS_FULL,
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.fillGradient = HelpFunc.fillGradient;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
if (isNodeJs) {
global.cv = cv;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase;
global.cvSize = Base.getCvSize();
} else {
enableButton();
console.log('opencv.js loaded');
if (isNodeJs) {
global.cv = cv;
+ global.fillGradient = HelpFunc.fillGradient;
+ global.smoothBorder = HelpFunc.smoothBorder;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase
global.cvSize = Base.getCvSize();
} else {
enableButton();
console.log('opencv.js loaded');
if (isNodeJs) {
global.cv = cv;
+ global.fillGradient = HelpFunc.fillGradient;
+ global.smoothBorder = HelpFunc.smoothBorder;
global.combine = HelpFunc.combine;
- global.cvtStr2cvSize = HelpFunc.cvtStr2cvSize;
+ global.log = HelpFunc.log;
+ global.decodeParams2Case = HelpFunc.decodeParams2Case;
+ global.setBenchmarkSuite = HelpFunc.setBenchmarkSuite;
+ global.addKernelCase = HelpFunc.addKernelCase
global.cvSize = Base.getCvSize();
} else {
enableButton();