Is there a way I can get an image from a camera preview? The purpose of this would be to overlay an emoji over the face of the camera preview, and I can't overlay the emoji images without first having a Bitmap image as follows:
private void processAndSetImage()
{
mResultsBitmap = OverlayEmoji.detectFacesandOverlayEmoji(this, mResultsBitmap);
mImageView.setImageBitmap(mResultsBitmap);
}
Is there a way that mImageView could have the value of a camera preview? Any links to other SO posts, or articles (in java) would be greatly appreciated!
Is there a way I can get an image from a camera preview?
No.
First, there are thousands of Android device models. These devices will have dozens, if not hundreds, of "android native camera" apps, as many device manufacturers frequently ship a customized camera app.
Second, there is no requirement that all camera apps have an identical user interface. The size and position of the camera preview can vary. Not only will they vary between apps, but even the same app might vary the size and position of the camera preview between versions of that app, as apps can and do get updated.
Third , you have no good way of determining when any of these camera apps happens to be in the foreground.
Related
I'm using
Intent(MediaStore.ACTION_IMAGE_CAPTURE)
to get a photo from the camera, it works fine on all devices, except for samsung devices where if you take photo with the frontal camera it appears rotated 180 degrees.
I can rotate the image 180 degrees to correct the issue with the frontal camera, but this causes the rear camera photos to be rotated as well.
Is there any way I can detect which camera is taking the picture, and therefore only rotate the frontal camera's images?
it works fine on all devices
No offense, but I rather doubt that. There are a lot of buggy camera apps. Bear in mind that some of those buggy camera apps are user-installed, not just pre-installed.
Is there any way I can detect which camera is taking the picture
Not really. I do not see an EXIF tag for that, and there is no requirement that the camera app put the tag in the image anyway. You are not told any details about the picture other than the picture itself. You could try playing some games, looking at the image resolution and comparing it with possible camera resolutions, but that will be unreliable.
In general, with ACTION_IMAGE_CAPTURE, you just wind up living with spotty results. Your primary alternative is to use a library to embed photo capture into your app (e.g., CameraKit-Android, Fotoapparat), trading off the unreliability of third-party camera apps with the unreliability of device manufacturer camera API support.
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!
I have very typical custom camera implementation. I'm using Camera.takePicture(...) method to take photos. And usually photos that are taken using front camera are horizontally inverted (mirrored). I'm totally fine with it, but I've noticed that on some devices it's not true and photos are not inverted. I would like to have a consistent behavior for all devices. So is there a way to know whether a photo is not inverted?
I have been struggling with creating a camera preview with a custom layout/overlay that mimics the functionality of the native camera app.
Is there any way I can simply constrain the size of the native camera preview and possibly overlay a grid image on top of it without having to fully rewrite all of the camera's functionality?
No. You cannot hack the UI of another app, any more than another app can hack your UI.
Also, bear in mind that there is no single "native camera app". There are dozens, perhaps hundreds, across the thousands of Android device models.
we are developing an Android App to be used on 1 of 2 Android cameras. Specifically the Nikon S800C.
We are able to use digital zoom but as yet we have not found a way of handling the hardware zoom which is the whole point of using a camera rather than a basic smart phone.
We cannot use the internal camera app as we have to make a custom camera overlay and preview screen. As such we have had to compose our own camera app.
It seems from what I have been advised it is not technically possible to control the camera hardware zoom from within our own app.
So my question is: Is this really the case? Is there absolutely no way of building a custom camera app that has a custom camera capture experience and also a camera HARDWARE zoom?
If this is the case, is there a way of creating a custom preview and camera overlay screen for the existing internal camera app on our device? Which would negate the need to build our own.
Thanks.