mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #19771 from lionkunonly:opencvjsNodeFix
* fix the perf tests of OpenCV.js so that it can run on Node.js successfully * do not modify the CMakeLists.txt Co-authored-by: lionkun <871518554@qq.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user