Permalink
Browse files

poitential fix for null pointer error. Test still screwed though.

  • Loading branch information...
1 parent b6468cf commit fa6e6b4da18d62a9657689bb503d96791eeaefc0 @peterbraden committed Nov 19, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/opencv.js
View
10 lib/opencv.js
@@ -20,7 +20,15 @@ var matrix = cv.Matrix.prototype;
matrix.detectObject = function(classifier, opts, cb){
opts = opts || {}
- var face_cascade = new cv.CascadeClassifier(classifier);
+ cv._detectObjectClassifiers = cv._detectObjectClassifiers || {}
+
+ if (cv._detectObjectClassifiers[classifier]){
+ var face_cascade = cv._detectObjectClassifiers[classifier];
+ } else{
+ var face_cascade = new cv.CascadeClassifier(classifier);
+ cv._detectObjectClassifiers[classifier] = face_cascade;
+ }
+
face_cascade.detectMultiScale(this, cb, opts.scale, opts.neighbors
, opts.min && opts.min[0], opts.min && opts.min[1]);
}

0 comments on commit fa6e6b4

Please sign in to comment.