Comments (9)
The provided information is not enough. I don't have that device, so there is currently no way I can fix this.
from cameraview.
I think this issue is related to #22, Several non-Nexus devices seem to have issues with image orientation. I had a look at the code that handles image orientation and I couldn't see anything wrong with it. I also noticed that these orientation problems don't seem to present when taking pictures with the camera2 basic example app . I'm not sure if that helps :(
from cameraview.
Thanks, Iván. I will keep on investigating.
If anyone can provide more information (camera characteristics on those devices, etc), it will be very helpful.
from cameraview.
I've encountered the same issue on S7, it may be resolved via rotation of a bitmap according to EXIF rotation:
val file = File(path)
if (file.exists()) {
val exif = ExifInterface(path)
val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1)
val degrees = when (orientation) {
ExifInterface.ORIENTATION_NORMAL -> 0
ExifInterface.ORIENTATION_ROTATE_90 -> 90
ExifInterface.ORIENTATION_ROTATE_180 -> 180
ExifInterface.ORIENTATION_ROTATE_270 -> 270
else -> 0
}
BitmapFactory.decodeFile(file, previewSize.maxValue)?.let { it ->
if (degrees > 0) {
val matrix = Matrix()
matrix.postRotate(degrees.toFloat())
imageView.setImageBitmap(Bitmap.createBitmap(it, 0, 0, it.width, it.height, matrix, true))
} else {
imageView.setImageBitmap(it)
}
} ?: e("Can't create preview bitmap")
}
I've saved photo into a temporary file, and then loaded it in a preview activity. If you don't want to save a file, try to use a device rotation info instead of EXIF...or maybe just grab it in runtime from library output(it already contains encoded image in the callback).
from cameraview.
Printing out EXIF orientation on stored images gives 6 for both front and back facing camera on a Sony Xperia Z2. However, the font facing camera captures an image that is rotated 180 (upside-down). Tell me what more you need @yaraki
from cameraview.
I am experiencing a 180 rotation (upside down) on the front camera of a Samsung Galaxy S4. The EXIF reports 8 (90 degrees) when the device is held in portrait position. Please tell me what other info you need @yaraki
Thanks!
from cameraview.
@yaraki My Sony Xperia Z2 (API23) falls back to the Camera1 implementation, and it seems fixed by #115 perhaps @WeRockStar could test it as well?
from cameraview.
@n0m0r3pa1n I've just updated the OS on the Z2 whenever a new update came, just like a normal user. If that answers your question?
from cameraview.
Thanks. I fix this problem with the this solution.
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
switch (orientation) {
case ExifInterface.ORIENTATION_NORMAL:
break;
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
from cameraview.
Related Issues (20)
- how to store a click photos in gallery
- FLASH_TORCH sticks until FLASH_OFF is used
- camera preview showing black ,Please look my code below to solve. HOT 2
- java.lang.NullPointerException@android.hardware.camera2.CameraCaptureSession.capture HOT 6
- Black preveiw for front facing camera
- Why fall back to Camera1
- rotate
- CameraView shows green color when turn the screen OFF and turn ON in Redmi note 5 only HOT 2
- NPE while setting the aspect ratio HOT 1
- How to install BurstMode in this ?
- when add android:configChanges="orientation|keyboardHidden|screenSize" toCameraActivity Screen Rotation show Black Screen HOT 1
- Caused by: java.lang.RuntimeException: Fail to connect to camera service HOT 2
- TakePicture flash problem
- Pinch to zoom with Google Android Calendar
- android.view.TextureView.onSizeChanged (TextureView.java:367)
- Exit Interface always returns 0 for Google pixel with Google camera
- OPPO R17 Redmi 8A Android 9 crash
- Demo app crashes when trying to switch camera front facing camera
- Camera
- Security Policy violation Binary Artifacts HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cameraview.