Permalink
Browse files

adding whole photo test

  • Loading branch information...
1 parent 0131b7c commit 7e43722bcd92a00d10c8a51e60de95e3b193eb24 @harthur committed May 21, 2012
Showing with 31 additions and 6 deletions.
  1. +7 −0 test.js
  2. +24 −6 training/test.js
View
7 test.js
@@ -0,0 +1,7 @@
+var kittydar = require("./kittydar"),
+ utils = require("./utils");
+
+utils.drawImgToCanvas(__dirname + "/test8.jpg", function(canvas) {
+ var cats = kittydar.detectCats(canvas);
+ console.log(cats);
+})
View
30 training/test.js
@@ -14,14 +14,32 @@ fs.readdir(dir, function(err, files) {
})
async.forEach(images, function(file, done) {
- // open .rect file
-
- utils.drawImgToCanvas(file, function(canvas) {
- var cats = kittydar.detectCats(canvas);
-
- // test against rect
+ fs.readFile(file + ".rect", "utf-8", function(text) {
+ var vals = text.split(" ");
+ var rect = {
+ x: vals[0],
+ y: vals[1],
+ width: vals[2],
+ height: vals[3]
+ };
+
+ utils.drawImgToCanvas(file, function(canvas) {
+ var cats = kittydar.detectCats(canvas);
+ cats.forEach(function(cat) {
+ if (doesOverlap(cat, rect)) {
+ // true positive
+ }
+ else {
+ // false positive
+ }
+ });
+ });
})
});
});
+function doesOverlap(rect1, rect2) {
+ if ()
+}
+

0 comments on commit 7e43722

Please sign in to comment.