James Zhao
James Zhao

Reputation: 418

Is that possible to take 3 photos with different exposure compensation on Android?

Below is my code:

private void takeMultiPictures(final int n) {
    if (n <= 0) {
        ToastUtils.show("Capture Successfully!");
        saveMultiPictures();
        return;
    }
    Parameters params = mCamera.getParameters();
    int mic = params.getMinExposureCompensation();
    int mac = params.getMaxExposureCompensation();
    switch (n) {
    case 3:
        params.setExposureCompensation(mac);
        break;
    case 2:
        params.setExposureCompensation(mic);
        break;
    case 1:
        params.setExposureCompensation(0);
        break;
    }
    mCamera.setParameters(params);
    mCamera.takePicture(null, null, null, new PictureCallback() {
        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
            mMultiPictures.add(data);
            mCamera.startPreview();
            takeMultiPictures(n - 1);
        }
    });
}

By this code, the camera will take 3 pictures, but the results are not stable.

The First Photo First photo

The Second Photo Second photo

The Thrid Photo Third photo

My device is Galaxy Nexus, the exposure compensation values supported are from -2 to 2.

Upvotes: 0

Views: 871

Answers (1)

maradatscha
maradatscha

Reputation: 51

Did you look at the return values of

int mic = params.getMinExposureCompensation();
int mac = params.getMaxExposureCompensation();

Are they actually -2 and 2?

you could call

mCamera.getParameters(params);

after setting the parameters to check if your setting holds.

Upvotes: 1

Related Questions