title: Slow down the setPreviewCallback method of a camera object
body: <p>I have the following code running on a camera object (mCamera) to detect faces in whatever the camera is pointing at. The problem is while this process is very fast indeed it slows the rest of the app down, i.e. when I press a button to do something while this face detection is running it takes about half a second to register it. My thinking is that is I somehow slow down or reduce the number of call back it makes in a certain time then this button press will be much faster:</p>
  
  <pre><code>Thread thread = new Thread(new Runnable() {
      public void run() {
          // TODO Auto-generated method stub
          mCamera.setPreviewCallback(new PreviewCallback() {
              public void onPreviewFrame(final byte[] _data, Camera _camera) {
                  Camera.Parameters parameters = mCamera.getParameters();
                  int format = parameters.getPreviewFormat();
                  // YUV formats require more conversion
                  if (format == ImageFormat.NV21) {
                      int w = parameters.getPreviewSize().width;
                      int h = parameters.getPreviewSize().height;
                      // Get the YuV image
                      YuvImage yuv_image = new YuvImage(_data, format, w, h, null);
                      // Convert YuV to Jpeg
                      Rect rect = new Rect(5 * w / 10, 1 * h / 5, 8 * w / 10, 4 * h / 5);
                      final ByteArrayOutputStream output_stream = new ByteArrayOutputStream();
                      yuv_image.compressToJpeg(rect, 10, output_stream);
                      // Convert from Jpeg to Bitmap
                      Bitmap bmp = Bitmap.createScaledBitmap(BitmapFactory.decodeByteArray(output_stream.toByteArray(), 0, output_stream.size()), 3 * w / 10, 3 * h / 5, true);
                      detectFaces(bmp, w, h);
                  }
              }
          });
      }
  });
  thread.start();
  </code></pre>
  
  <p>It is already inside a Thread as I thought that may help but has not really. Is there anyway to change the call back frequency?</p>