mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
add opencv.js imread function can use OffscreenCanvas
This commit is contained in:
@@ -57,7 +57,7 @@ Module['imread'] = function(imageSource) {
|
|||||||
canvas.height = img.height;
|
canvas.height = img.height;
|
||||||
ctx = canvas.getContext('2d', { willReadFrequently: true });
|
ctx = canvas.getContext('2d', { willReadFrequently: true });
|
||||||
ctx.drawImage(img, 0, 0, img.width, img.height);
|
ctx.drawImage(img, 0, 0, img.width, img.height);
|
||||||
} else if (img instanceof HTMLCanvasElement) {
|
} else if (img instanceof HTMLCanvasElement || img instanceof OffscreenCanvas) {
|
||||||
canvas = img;
|
canvas = img;
|
||||||
ctx = canvas.getContext('2d');
|
ctx = canvas.getContext('2d');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user