yukiapple323 commited on
Commit
e36a15d
1 Parent(s): 4140fd4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +5 -4
index.html CHANGED
@@ -1,4 +1,4 @@
1
- <<!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
@@ -58,8 +58,9 @@
58
 
59
  captureButton.addEventListener('click', () => {
60
  // Draw the video frame to the canvas
61
- canvas.width = video.videoWidth;
62
- canvas.height = video.videoHeight;
 
63
  const context = canvas.getContext('2d');
64
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
65
  // Convert canvas to image data
@@ -87,7 +88,7 @@
87
  console.log("Sugar match found:", sugarMatch);
88
  const sugarContent = parseFloat(sugarMatch[2]);
89
  let message = `Sugar content: ${sugarContent}g - `;
90
- if (sugarContent > 51) {
91
  message += 'Dangerous';
92
  output.className = 'red';
93
  } else if (sugarContent >= 21 && sugarContent <= 50) {
 
1
+ <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
 
58
 
59
  captureButton.addEventListener('click', () => {
60
  // Draw the video frame to the canvas
61
+ const scaleFactor = 0.5; // Reduce image size by half
62
+ canvas.width = video.videoWidth * scaleFactor;
63
+ canvas.height = video.videoHeight * scaleFactor;
64
  const context = canvas.getContext('2d');
65
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
66
  // Convert canvas to image data
 
88
  console.log("Sugar match found:", sugarMatch);
89
  const sugarContent = parseFloat(sugarMatch[2]);
90
  let message = `Sugar content: ${sugarContent}g - `;
91
+ if (sugarContent > 50) {
92
  message += 'Dangerous';
93
  output.className = 'red';
94
  } else if (sugarContent >= 21 && sugarContent <= 50) {