From 7ad8ea27098e084fa5da28aa5097019e390b595e Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Tue, 9 Jul 2024 16:15:40 +0200 Subject: [PATCH] Update WebCamera.cpp --- apps/source/WebCamera.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/source/WebCamera.cpp b/apps/source/WebCamera.cpp index 3711dffb..583e710a 100644 --- a/apps/source/WebCamera.cpp +++ b/apps/source/WebCamera.cpp @@ -6,7 +6,7 @@ * \copyright http://opensource.org/licenses/GPL-3.0 * \remarks Please use clangformat to format the code. See more code style on * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style -*/ + */ #include #include @@ -86,7 +86,10 @@ CVMat WebCamera::read() EM_ASM({ let video = document.querySelector("#capture-video"); let canvas = document.querySelector("#capture-canvas"); - let ctx = canvas.getContext("2d"); + + // the last parameter canvas_will_read_frequently is set to true + // https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently + let ctx = canvas.getContext("2d", true, false, "srgb", true); let width = video.videoWidth; let height = video.videoHeight;