title: OpenCV GPU FaceDetector Example crashing on random frames
body: <p>I'm trying out the Haarcascade based FaceDetection using the GPU module in OpenCV 2.3.1.</p>
  
  <p>My code is compiling and sometimes it shows the initial frame with one or more ROI-rectangles drawn onto the output frame to highlight detected objects.</p>
  
  <p>But after the 2nd or 3rd repeated call of this detector method it just crashes. The compiler says SIGABRT. Any suggestions on this?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>cv::Mat ProcessorWidget::detectGPU(Mat &amp;img) {
  
      cv::gpu::CascadeClassifier_GPU cascade_gpu(QFileDialog::getOpenFileName(this).toStdString());
  
      img.copyTo(image_cpu);
      gpu::GpuMat image_gpu(image_cpu);
  
      gpu::GpuMat objbuf;
      int detections_number = cascade_gpu.detectMultiScale( image_gpu,
                objbuf, 1.2);
  
      Mat obj_host;
      // download only detected number of rectangles
      objbuf.colRange(0, detections_number).download(obj_host);
  
      Rect* faces = obj_host.ptr&lt;Rect&gt;();
      for(int i = 0; i &lt; detections_number; ++i)
         cv::rectangle(image_cpu, faces[i], Scalar(255));
      return image_cpu;
  }
  </code></pre>
  
  <p>Another point is that some of the Haarcascade Classifiers coming with OpenCV will always crash my application when i use them. But some other classifiers always work on the first frame and then crash a few frames later.</p>
  
  <p>BTW I initialize the classifier from within this method just for testing purposes. Inititalizing it just once when constructing the ProcessorObject didn't help either ...</p>
  
  <p>Could the classifier-XML's be incompatible somehow?</p>
  
  <p>Thanks in Advance!</p>