public void initialize(boolean mirror, int displayOrientation) {
    mPreviewWidth = ApplicationScreen.getPreviewSurfaceLayoutWidth();
    mPreviewHeight = ApplicationScreen.getPreviewSurfaceLayoutHeight();

    Matrix matrix = new Matrix();
    Util.prepareMatrix(matrix, mirror, 90, mPreviewWidth, mPreviewHeight);
    // In face detection, the matrix converts the driver coordinates to UI
    // coordinates. In tap focus, the inverted matrix converts the UI
    // coordinates to driver coordinates.
    matrix.invert(mMatrix);

    mInitialized = true;
  }