Skip to content

Commit

Permalink
line detection block
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Lei authored and Brandon Lei committed Sep 30, 2024
1 parent 4e56887 commit 3a72da5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions extensions/src/doodlebot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export default class DoodlebotBlocks extends extension(details, "ui", "indicator
console.log("No line detected");
return;
}

console.log("Line coordinates:", JSON.stringify(lineCoordinates));

// Create a drawable if it doesn't exist
if (!this.videoDrawable) {
this.videoDrawable = await this.createVideoStreamDrawable();
}

// Create a temporary canvas to draw on
const canvas = document.createElement('canvas');
canvas.width = this.imageStream.width; // Assume these properties exist
canvas.height = this.imageStream.height;
Expand All @@ -129,7 +129,6 @@ export default class DoodlebotBlocks extends extension(details, "ui", "indicator
if (ctx) {
ctx.drawImage(this.imageStream, 0, 0, canvas.width, canvas.height);

// Draw the line on the canvas
ctx.beginPath();
ctx.moveTo(lineCoordinates[0][0], lineCoordinates[0][1]);
for (let i = 1; i < lineCoordinates.length; i++) {
Expand All @@ -139,7 +138,6 @@ export default class DoodlebotBlocks extends extension(details, "ui", "indicator
ctx.lineWidth = 2;
ctx.stroke();

// Update the drawable with the new canvas content
this.videoDrawable.update(canvas);
}
}
Expand Down

0 comments on commit 3a72da5

Please sign in to comment.