How to know which camera a photo was taken by on android? - android

I got a requirement to know which images were taken by the front camera and which were taken by the back camera on android device, i tried with SQLiteEditor to read system images database, but there is no useful information about which camera the images were taken by, also i tried with Exif Viewer, and the only thing may help are the FNumber and ApertureValue, here is the data copy from my Nexus5, running the newest lollipop system.
all the photos taken by front camera
FNumber f/2.4 ApertureValue 2.52
all the photos taken by back camera
FNumber f/2.9 ApertureValue 3.07
This is a part of exif data of the photos on my phone, i don't have other device, i want to know what's the relationship between those two values with two cameras on android device ? Is that information is enough to know which camera a photo was taken by ?
Thanks in advance.

Related

Accessing camera at same time

Let say there is an online proctor application that is using webcam while examination and they're giving
an option to upload the photo of written answer that is on A4 sheet through camera.
So i just want to know is it possible that when we're taking picture of answer at that time also they using camera as a webcam .
because i think it can use either for webcam or for clicking photos

Samsung front camera issue

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.

How can I differentiate if a picture is made fron the internal or external camera

Hello I am trying to make an app and I need to differentiatie if a photo has been tanken forn the internal or external camera of my smartphone. I need this because my smartphone rotates the photos in one or another direction depending on which camera the photo has been made for.
I need to know to be able to apply the rotation in the correct direction to leave the picture ok.
Thanks in advance!!

Picture Clicked from default camera not getting saved with proper orientation

Iam trying to capture a picture using
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (intent.resolveActivity(getPackageManager()) != null) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, REQUEST_CODE);
}
}
but when i get the result, the orientation of the picture is not proper in most of the cases. Since I need to use the picture at a number of places, so I want the picture to be saved with the proper orientation. How can this be done?
Doubt :
1. Doesn't android default camera itself take care of the orientation when saving picture?
2. DO I have to use "ExifInterface" tweak every time when I display the picture from local?
the orientation of the picture is not proper in most of the cases
That depends on your opinion of what is "proper". Various device manufacturers and camera apps believe that having an EXIF orientation tag is perfectly proper.
How can this be done?
You are welcome to scan the image for the EXIF header and rotate the image yourself, but this is slow and memory-intensive.
Doesn't android default camera itself take care of the orientation when saving picture?
First, you are not necessarily using any "android default camera". Any camera app can respond to your Intent. There are thousands of device models, with hundreds of pre-installed camera apps, let alone apps that users might get from the Play Store or elsewhere.
Second, as noted above, some developers feel that "take care of the orientation" is having the appropriate EXIF header.
DO I have to use "ExifInterface" tweak every time when I display the picture from local?
Well, that depends. You could convert it once and save the converted image, then use the converted one going forward, rather than converting it every time. Whether or not it is appropriate for you to saving a converted image or not is up to you and your users.

detect if a picture was taken with the front camera

In my application, i want to take picture using built-in camera application. Taking picture process is working fine. I want to know is picture taken from front camera or back camera, because after taking picture i want to get the rotation angle and rotate the picture to that angle and store it in sdcard. ExifInterface always return the same angle(90) rather user take the picture from front/back camera. When user take the picture from back camera, rotation is fine but when user take the picture from front camera, picture rotation is wrong. Please suggest any solution for this problem.
Thanks
I believe that your device does something wrong with the rotation flag. You should try other devices, too.
Note that MediaStore.ACTION_IMAGE_CAPTURE may be fulfilled by different Camera apps on different devices, or even on the same device: the end user is free to choose. Some downloaded applications will respect an extra to choose the front camera (see https://stackoverflow.com/a/11159760/192373), other won't. Some will do a better job to provide correct EXIF, others will mess it up.

Categories

Resources