Skip to content
This repository
Browse code

adding whole photo test

  • Loading branch information...
commit 7e43722bcd92a00d10c8a51e60de95e3b193eb24 1 parent 0131b7c
Heather Arthur authored

Showing 2 changed files with 31 additions and 6 deletions. Show diff stats Hide diff stats

  1. 7  test.js
  2. 30  training/test.js
7  test.js
... ...
@@ -0,0 +1,7 @@
  1
+var kittydar = require("./kittydar"),
  2
+    utils = require("./utils");
  3
+
  4
+utils.drawImgToCanvas(__dirname + "/test8.jpg", function(canvas) {
  5
+  var cats = kittydar.detectCats(canvas);
  6
+  console.log(cats);
  7
+})
30  training/test.js
@@ -14,14 +14,32 @@ fs.readdir(dir, function(err, files) {
14 14
   })
15 15
 
16 16
   async.forEach(images, function(file, done) {
17  
-    // open .rect file
18  
-
19  
-    utils.drawImgToCanvas(file, function(canvas) {
20  
-      var cats = kittydar.detectCats(canvas);
21  
-
22  
-      // test against rect
  17
+    fs.readFile(file + ".rect", "utf-8", function(text) {
  18
+      var vals = text.split(" ");
  19
+      var rect = {
  20
+        x: vals[0],
  21
+        y: vals[1],
  22
+        width: vals[2],
  23
+        height: vals[3]
  24
+      };
  25
+
  26
+      utils.drawImgToCanvas(file, function(canvas) {
  27
+        var cats = kittydar.detectCats(canvas);
  28
+        cats.forEach(function(cat) {
  29
+          if (doesOverlap(cat, rect)) {
  30
+            // true positive
  31
+          }
  32
+          else {
  33
+            // false positive
  34
+          }
  35
+        });
  36
+      });
23 37
     })
24 38
   });
25 39
 });
26 40
 
27 41
 
  42
+function doesOverlap(rect1, rect2) {
  43
+  if ()
  44
+}
  45
+

0 notes on commit 7e43722

Please sign in to comment.
Something went wrong with that request. Please try again.