CameraKit / camerakit-android

Library for Android Camera 1 and 2 APIs. Massively increase stability and reliability of photo and video capture on all Android devices.
https://camerakit.io
MIT License
5.36k stars 878 forks source link

FACING_FRONT captured picture , Mirror Problem #566

Closed brkcnplt closed 4 years ago

brkcnplt commented 5 years ago

Is there any way to hold the picture constant ? I tried to use

camerakit:ckMethod="still" but ckMethod is not resolved. It might be because of the version. If I rotate the camera to FACING_BACK and then capture an image , there is no problem. But on the FACING_FRONT this issue occured.

before capture Screenshot_1567674510

after capture Screenshot_1567674517

brkcnplt commented 4 years ago

I've found solution which is :

fun flip(src:Bitmap):Bitmap { // create new matrix for transformation if(camera.facing==CameraKit.FACING_BACK) { val matrix = Matrix() matrix.preScale(-1.0f, 1.0f) // return transformed image return Bitmap.createBitmap(src, 0, 0, src.width, src.height, matrix, true) } else { val matrix = Matrix() matrix.preScale(1.0f, -1.0f) return Bitmap.createBitmap(src, 0, 0, src.width, src.height, matrix, true) } }

also u need you use this in captureImage part

capturedView.setImageBitmap(flip(bitmap))