From 4e050e85ada4c8fcccb286841d830a232b5ba167 Mon Sep 17 00:00:00 2001 From: Zero2key Date: Mon, 3 Apr 2023 10:33:20 +0800 Subject: [PATCH] add opencv.js imread function can use OffscreenCanvas --- modules/js/src/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/js/src/helpers.js b/modules/js/src/helpers.js index 59e6e65b29..9f1934c279 100644 --- a/modules/js/src/helpers.js +++ b/modules/js/src/helpers.js @@ -57,7 +57,7 @@ Module['imread'] = function(imageSource) { canvas.height = img.height; ctx = canvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(img, 0, 0, img.width, img.height); - } else if (img instanceof HTMLCanvasElement) { + } else if (img instanceof HTMLCanvasElement || img instanceof OffscreenCanvas) { canvas = img; ctx = canvas.getContext('2d'); } else {