android camera2 setTorchMode too slow - android

I am using Camera2 to turn on the Flash Light on my Android phone with the following :
camManager.setTorchMode(cameraId, true);
But the thing is it's really slow (like half a second to open), compared to the iOS flashlight. I can't find any instantaneous flashlight, is it a hardware issue..?
Thanks in advance!

It's a hardware issue.
If the underlying hardware directly supports a enable-torch call at the HAL (hardware abstraction layer) interface, turning the flash on and off is very fast.
But if it doesn't, the Android OS has to actually open a camera device and turn on the flash via the full camera API. And unfortunately, powering on and off the camera is not a quick (or power-efficient) operation.
The needed HAL interfaces for this were added in Android 6.0 along with the setTorchMode API, but since the backwards compatibility code exists in the OS, not all manufacturers have added the necessary HAL implementation for fast flash control.

Related

connecting USB UVC camera with CameraX

I'm trying to make an android app that preview a stream from an external USB camera.
I can see the camera using UsbManager but for some reason, the CameraX doesn't list it in the connected camera list.
Does anyone have an idea how to fix this?
Also, I've downloaded for my android device some random app that allows streaming from a USB camera and it worked so I don't think it is a problem that the camera isn't compatible to work with an android device or something like that.
afaik CameraX doesn't support UVC cameras yet/still and Android doesn't provide a driver... for Android system UVC camera is just "some USB" device (as you noticed - handled by UsbManager) and you need to provide a driver by self...
so you can use some other libraries for getting UVC video, probably currently best is AndroidUSBCamera by jiangdongguo

moto z2 play camera2 wrong capabilities?

Okay, I just got a new Moto z2 play and decided to try and learn the Android Camera2 api using it... The phone is not rooted, and the stock camera app has the option to record slow motion videos and have manual focus during photos... But when I probe the CameraCharacteristics using the Camera2 api, it shows me a LEGACY hardware level device, with no support for high fps recording nor manual sensor control... I've read in the internet that build.prop can be edited so that the device reports the full supported capabilities... But to my understanding, if those capabilities were not supported by default, it wouldn't be possible for stock camera app to show them, right...? So, what's going on? Is there some caveat I'm missing?
The stock camera app likely has custom interfaces to use those features, built on top of the legacy camera HAL.
Unfortunately, the standard camera2 API cannot run on top of the legacy HAL besides in LEGACY mode, because there's no way to automatically hook into custom OEM additions to the legacy HAL.
So there's likely nothing you can do here to enable these features in your own app; Motorola would have to update their entire camera stack to expose a modern camera HAL for camera2 to work better.

Can I emulate camera flash with Android emulator?

Can I emulate camera flash with Android emulator? I wasn't able to find anything flash-related in the settings.
Flash is manipulated via camera object by setting flash mode before taking picture
or preview. Emulator will allow you to do this. But I found flash behaviour extremely inconsistent across different devices.
Real camera applications use undocumented native apis which are specific for phone and camera models.

Communicating Between Digital Camera and Android Tablet

I was wondering if there was a known camera that was compatible with android OS's. (such as the nexus 7).
I am trying to essentially control a high resolution digial camera from the android tablet so that it can control when to take a picture, and then retrieve the picture.
This would require a camera with a public API.
I have experience in android programming but not too much in communicating between two different devices. So i was wondering what I should look into in order to achieve this.
Here is a camera that runs Android: http://news.yahoo.com/samsung-takes-aim-japanese-rivals-android-camera-034717081--finance.html
And since it is Android I guess that the API is public.
And the same camera with more info: http://www.samsung.com/uk/consumer/mobile-devices/galaxy-camera/galaxy-camera/EK-GC100ZWABTU and it does run what look like standard android apps.
If you want to control that from another Android device, I think that would make a very interesting project.
The other possibility is the Nikon external control SDK, but I have no idea what language that is in. That was used to build the excellent Sofortbild app for Macs, which controls most Nikon DSLRs. https://sdk.nikonimaging.com/apply/
There are Android applications which can control a set of cameras with added features. The one I'm using gives me the ability to take very specific timelapse shots which would be too complicated or even impossible to get through the camera's own controls. You can find many other control apps on the play store.
Unfortunately this one is only for Canon EOS cameras : DSLR Controller

Hardware capabilities and actual implementation of Android API of a device

Up to now I was only developing in J2ME and would like to know about the differences compared to Android.
The situation for a java enabled phone is that it might, for example, has a built-in camera, but the manufacturer didn't implemented the Java API for camera capabilities. Which means you can't use that API. It is even possible that only parts of an API were implemented.
Now, what about Android? For what I know, when a device has Android Platform 2.2 it supports every API Level up to Level 8. And I would guess, that if the built in camera doesn't have a flash then you can't use the Android API call to change the flash mode. Is that right?
Now let's assume that the device has a built in flash enabled camera. Can a developer be sure that the function for changing the flash mode can be used, or is it possible that the manufacturer didn't implemented that specific function even though it is part of the supported API Level which the device was advertised for?
And I would guess, that if the built in camera doesn't have a flash then you can't use the Android API call to change the flash mode. Is that right?
So long as you set it to a valid value, you can always use the API. However, in your case, there is probably only one valid value (i.e., no flash).
Now let's assume that the device has a built in flash enabled camera. Can a developer be sure that the function for changing the flash mode can be used, or is it possible that the manufacturer didn't implemented that specific function even though it is part of the supported API Level which the device was advertised for?
Android devices that do not have the Android Market have no guarantees whatsoever regarding their compatibility with third-party apps.
Android devices that do have the Android Market must pass a compatibility test suite. Whether or not that test suite has a specific test for a specific API can only be determined by looking at the test suite code.
So, it depends on how you define "sure". Developers usually don't have to worry about it, but device firmware bugs do happen.

Categories

Resources