]> _ Git - 1000pourcent.git/commitdiff
wip #3206 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Nov 2019 11:32:38 +0000 (12:32 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Nov 2019 11:32:38 +0000 (12:32 +0100)
.htaccess [new file with mode: 0644]
.htpasswd [new file with mode: 0644]
detect.js
index.html

diff --git a/.htaccess b/.htaccess
new file mode 100644 (file)
index 0000000..bd3550b
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,9 @@
+AuthType Basic
+AuthName "Please enter your username and password"
+AuthUserFile /home/cubedesigners/demo1/1000pct/.htpasswd
+
+<RequireAny>
+    Require ip 88.190.245.49
+    Require ip 82.251.249.101
+          Require valid-user
+</RequireAny>
\ No newline at end of file
diff --git a/.htpasswd b/.htpasswd
new file mode 100644 (file)
index 0000000..8483fe2
--- /dev/null
+++ b/.htpasswd
@@ -0,0 +1 @@
+1000pct:$apr1$a0v1CSrP$yGYBvju7bFPsjueBEDux0/
index 60b9eabc49151dc55adbf4ae15da9bab6bd979a0..cae2a30e24f1c249843d2ce24ea90f75333ec12e 100644 (file)
--- a/detect.js
+++ b/detect.js
@@ -1,6 +1,8 @@
 document.addEventListener('DOMContentLoaded', function () {
     drawImage('assets/input.jpg', 'input', function () {
-        detect();
+        var start=Date.now();
+        detectBoard(input);
+        console.log(Date.now()-start);
     });
 })
 
@@ -14,8 +16,10 @@ function drawImage(url, canvas, callback) {
     img.src = url;
 }
 
-function detect() {
-    let src = cv.imread('input');
+// Read the image input and detect the contour of the board.
+// Return an array of points
+function detectBoard(id) {
+    let src = cv.imread(id);
     let dst = cv.Mat.zeros(src.rows, src.cols, cv.CV_8UC3);
     let gray = new cv.Mat();
     cv.cvtColor(src, gray, cv.COLOR_BGR2GRAY);
@@ -75,6 +79,6 @@ function detect() {
         const vertex = {x: c.contour.data32S[j * 2], y: c.contour.data32S[j * 2 + 1]};
         res.push(vertex);
     }
-    console.log(res);
     cv.imshow('output', dst);
+    return res;
 }
\ No newline at end of file
index 533ea0c6a374cc3cfe850967bf55a7e119b07589..e5598a074cbc32b6c794afec94ef82a8671966aa 100644 (file)
@@ -3,7 +3,7 @@
 <head>
     <meta charset="UTF-8">
     <title>Title</title>
-    <script type="text/javascript" src="https://docs.opencv.org/master/opencv.js"></script>
+    <script src="https://docs.opencv.org/master/opencv.js"></script>
 </head>
 <body>
 <canvas id="template" width="200" height="200"></canvas>