Search This Blog

Thursday, 15 September 2016

Source code of flip front camera mirror flipped video, Reverse flip front camera video

While taking video from front camera, its shows preview like a mirror. Your left ear will be shown as right in camera preview.

If you pick example from snapchat, they simply show video same as like camera preview was showing. And that feature looks good. User want the exact picture which one’s seeing in preview, if it translate it can completely change video look.

Contact me for source code, implementation help and following features

  •  Ready to use code
  • Camera preview rotation fix on most of the device
  • Android flip front camera mirror flipped video
  • Video player and Camera preview full source with ownership
  • Extra support in integrating

Email me your requirement on codeinandroid@gmail.com/abdul.tofeeq@gmail.com.


Stop front facing camera from mirroring (inverting) image programmatically?

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);
}

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


See how to reverse flip video taken from front facing camera. 


Android News and source code