Android Camera:Front-camera mirror images - android

How to make the front camera NOT be a mirror image ? I can't find the interface about how to mirror the image.
I am using the Android 4.2.

There's a post here that describes how to mirror, it uses a matrix to flip it. However, I'd try it out on a variety of devices first- I hadn't heard that about the front camera and would be surprised if it wasn't a device specific thing.

Related

Image Orientation on Camera API

I am making an app using Camera API.Although I can capture images, they are not orientated properly.I already tried using screen orientation to correctly orient the images, but it dosent work on all devices especially on front camera.I am new to android development, any help would be appreciated.Thankyou.
You can get rotation of captured bitmap using ExifInterface and create another bitmap with fixed rotation - here you can find example of usage.
Moreover, I recommend to use inBitmap option for reusing existing bitmap into created rotated one.
Camera1 and Camera2 APIs are kinda tricky ones.It is useful to know how they work inside but there are plenty of ready solutions. I can recommend the following ones:
https://camerakit.io - has fixes for rotation issues inside but
currently in beta, supports Camera2 features.
https://github.com/RedApparat/Fotoapparat - based on Camera1.
https://github.com/natario1/CameraView - based on Camera1, can
capture video.

Will the front facing camera work with ARCore

Is it possible to use the device's front facing camera with ARCore? I see no references in Google's docs.
I can't find any reference in the docs. It would also make the whole AR process much more complicated. You have to invert the logic for moving the camera etc. And it's much harder to recognize planes as the user is always in the way. Right now, ARCore only recognizes planes so you can't detect feature points, e.g. in the face of a user.
The answer is: Yes.
With a front-facing camera (without a depth sensor) on any supported Android device you can track users' face since ARCore 1.7 SDK release. The API allowing you to work with a front-facing camera was named Augmented Faces. So, from now you can create a high quality 468-point 3D mesh that your Android app can overlay on a user’s face to bring fun animated effects.

Android front camera video capture mirroring

I am making an application using front camera and recently came up with this issue that outcomes of captured image and video are different(left-right inverted) from what I've seen through the display.
So for the image I could process it right after taking the picture because the size of the image wasn't too big - I used matrix preScale to mirror the image.
However, I have no idea how to do that with video capture. I already know that Android default camera does not mirror the front camera video output and lots of famous applications have compromised with default setting. But at the same time there are some camera related applications such as Instagram, Snow Camera, and B612 that do exactly what I want.
So my questions are,
Is it possible to mirror the front camera video output using Android MediaRecorder and Camera class? (That's what I've been using so far)
Or do you have to process the video after you take it? And if so, is there any nice and fast way of doing it?
It would be nice if any of you can answer it specifically. Thank you in advance!

Using Camera without preview or surface in android

I was looking for a method to use the camera on android devices without a surfaceview or a preview. I found out that, it is impossible to take picture without that preview. However, I have found a tutorial which is actually working taking pictures without a preview. Here is the link: http://www.vogella.com/articles/AndroidCamera/article.html
After switching the camera in the code from front to back-facing the app didn't crashed but it gave me an error 100. So it is only working with the front cam at the moment.
I am using a Samsung Galaxy S3(4.1.2) and i will test it on a Galaxy S2 and a Galaxy S3 Mini.
Anyone a good explanation for this?
You cannot take a picture without starting preview.
While some Android devices are more flexible, and allow takePicture to be called without preview running, this is technically against the API specifications.
It won't work on a large number of devices, so please don't rely on it. That tutorial is wrong, and presumably tested only on one of the devices that allows this behavior.
If you don't want a visible preview, see this question for ways to do that in Android versions >= 3.0.
Actually the time interval of question and answer is large, but may help others.
You can try this library to take picture even from service:
https://github.com/kevalpatel2106/android-hidden-camera
It uses a feature to draw over other apps and create a fake surface. Hope it helps.

Droid device - won't rotate image captured from camera? (Camera.Parameters)

I'm using this camera code to ask the camera to rotate the captured image data:
Camera.Parameters params = camera.getParameters();
params.set("rotation", 90);
camera.setParameters(params);
this seems to work on all phones, except the Droid. Has anyone else seen this? The image data is always landscape, however, the native camera app on the Droid produces portrait images ok.
I wonder if the Droid will only respect the new Camera.Parameters.setRotation() method, but this seems to only be available in API level 5?
setRotation also didn't seem to work for me on Nexus One, but I did get image rotation to work by following the example of the android Camera app itself.
The source code is available here:
https://android.googlesource.com/platform/packages/apps/Camera
Start with the Camera.java, but you'll also be looking at ImageManager.java, Util.java, and other files.
The basic idea is, you listen for orientation changes and capture what the orientation is at the time you snapped the picture. Then, when you get the picture bytes in the callback, you manipulate the bitmap, doing a rotation on the bitmap. Then convert the rotated bitmap back to jpeg. When you are done, you'll have had to copy a shocking amount of code from the camera app just for this rotation.
The rotation may just be stored in the jpeg exif header as explained in the setRotation document. On Droid that is actually the case. You can use jpeg header reading tools like jhead to verify this. You can also use the ExifInterface API to read the orientation tag in your program.
The Droid runs Android 2.0 (well, now 2.0.1) which are API levels 5 and 6, respectively.
So it's quite possible that the Droid only respects the (more sensible) 2.0+ API for rotation.
However, I guess your concern is compatibility across a range of device types and OS versions, so I imagine you would have to invoke the 2.0+ API via reflection after detecting the OS version (using android.os.Build.VERSION_CODES).

Categories

Resources