add opencv.js imread function can use OffscreenCanvas

pull/23451/head
Zero2key 2 years ago committed by GitHub
parent 3ac06bf063
commit 4e050e85ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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 {

Loading…
Cancel
Save