I am taking photo capture using front camera using my custom camera app not using system camera app.But the captured photo is very dark so can see photo properly.
my code
mCamera = Camera.open(1);
Camera.Parameters params =mCamera.getParameters();
params.setSceneMode(Camera.Parameters.SCENE_MODE_NIGHT);
mCamera.setParameters(params);
And to take picture
if (mCamera != null) {
try {
mCamera.setPreviewDisplay(mSurfaceHolder);
mCamera.startPreview();
mCamera.takePicture(null, mPictureCallback,
mPictureCallback);
} catch (IOException e) {
e.printStackTrace();
}
}
Thanks in advance. Please give me suggestions. any help will be appreciated.
Take photos 1 Request the camera feature. If an essential function of your application is taking pictures, then restrict its visibility on Google Play to devices that have a camera. 2 Take a photo with a camera app. ... 3 Get the thumbnail. ... 4 Save the full-size photo. ... 5 Add the photo to a gallery. ... 6 Decode a scaled image. ...
The camera in an android phone does the autofocus activity after the start of the preview and before capturing the picture. The code snippet in the question mentions call to mCamera.takePicture (null, mPictureCallback,mPictureCallback); right after mCamera.startPreview ();.
The Android Camera application saves a full-size photo if you give it a file to save into. You must provide a fully qualified file name where the camera app should save the photo. Generally, any photos that the user captures with the device camera should be saved on the device in the public external storage so they are accessible by all apps.
The Android Camera application encodes the photo in the return Intent delivered to onActivityResult() as a small Bitmap in the extras, under the key "data". The following code retrieves this image and displays it in an ImageView.
To solve this problem you could take the picture after some time. Try this:
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
camera.takePicture(null, null, cameraCallback);
}
}, 1000);
I have found following solution for this, And that worked for me
Wait for some time i.e. 500 ms before capture image using
mCamera.takePicture(null, mPictureCallback,mPictureCallback);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With