While taking picture from front camera, its shows preview
like a mirror. Your left ear will be shown as right in camera preview. Referhow to take picture from Camera and SurfaceView for camera basics.
If you pic example from snapchat, they simply show picture
same as like camera preview was showing. That feature looks good. User want the
exact picture which one’s seeing in preview, if it translate it can completely
change image/picture look.
When you capture bitmap from byte array, you can translate
it back to what was showing in camera preview. Look at code below –
Matrix matrix = new Matrix();
if (face) { // reverse flipping of image should only need to be handle for front facing camera
matrix.preScale(1.0f, -1.0f);
}
if (face) { // reverse flipping of image should only need to be handle for front facing camera
matrix.preScale(1.0f, -1.0f);
}
Apply matrix to bitmap and create a new one –
Bitmap new_bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(),
bitmap.getHeight(), matrix, true);
// bitmap is old bitmap which we created from byte array of camera stream
No comments:
Post a Comment
Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging