From e26467396a3573509c3b44e8e21db3a50bba2630 Mon Sep 17 00:00:00 2001 From: DewiKimC <97511825+DewiKimC@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:23:35 +0100 Subject: [PATCH] fixed pointer error --- lib/wrappers/javascript/contourwall.ts | 5 ++++- lib/wrappers/javascript/demo.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/wrappers/javascript/contourwall.ts b/lib/wrappers/javascript/contourwall.ts index d58134c..e4209df 100644 --- a/lib/wrappers/javascript/contourwall.ts +++ b/lib/wrappers/javascript/contourwall.ts @@ -1,6 +1,8 @@ import { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/mod.ts'; import { sleep } from "https://deno.land/x/sleep/mod.ts" +import { Mat } from "https://unpkg.com/opencv-wasm@4.3.0-10/types/opencv.ts"; + export class ContourWall { private lib @@ -42,9 +44,10 @@ export class ContourWall { ); this.cw_core_ptr = null; this.baudrate = baudrate + this.pixels = new cv.Mat(40, 60, cv.CV_8UC3); - this.pixels.set([0, 0, 0]); + this.pixels.setTo(new cv.Scalar(0, 0, 0)); } new(){ diff --git a/lib/wrappers/javascript/demo.ts b/lib/wrappers/javascript/demo.ts index 59afebc..408f574 100644 --- a/lib/wrappers/javascript/demo.ts +++ b/lib/wrappers/javascript/demo.ts @@ -1,3 +1,5 @@ +import { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/mod.ts'; +import { Mat } from "https://unpkg.com/opencv-wasm@4.3.0-10/types/opencv.ts"; import { ContourWall } from "./contourwall.ts"; const cw = new ContourWall(); @@ -12,6 +14,7 @@ import { ContourWall } from "./contourwall.ts"; "/dev/cu.usbmodem578E0073651" ); - cw.pixels.set([255, 255, 255]); // Set all pixels to white + cw.pixels.setTo(new cv.Scalar(255, 255, 255)); // Set all pixels to white cw.show(100); + \ No newline at end of file