CameraX: Google’s New Weapon in the Photography Wars

CameraX: Google’s New Weapon in the Photography Wars

Ever since it introduced Android, Google has struggled to provide a camera framework for developers that allows them to both build camera-enabled apps quickly and take advantage of the advanced capabilities being offered by phone makers. Its first Camera API was limited, and the second version is complicated. Neither has a vendor-independent way to activate some of the advanced modes that have been added to phones for improving image quality and adding stylistic effects. Now, Google is launching CameraX, a library that provides not just a simplified way for developers to access Android’s Camera2 functionality, but provides extensions for additional capabilities.

CameraX Is a Simpler Way to Harness the Power of Camera2

CameraX: Google’s New Weapon in the Photography Wars

To work with CameraX a developer specifies a desired use case with configuration options. Listeners are then added to handle the data output by the CameraX library — which can be either in the form of a data stream or written directly to a file. Finally, the use cases are bound to Android Architecture Lifecycles, so that CameraX can handle some of the housekeeping associated with setup and teardown of resources for the application. One nice feature of CameraX is that multiple use cases can be run simultaneously, so a preview can remain live while images or video are analyzed and perhaps captured, for example.

CameraX previews are bound to surface textures
CameraX previews are bound to surface textures

CameraX supports several use cases: Preview, to get an image on the display; Image analysis, to get direct access to the image buffer; and Image capture, to save a fully-processed image or video. Google provides several sample applications for various use cases. As is the recent trend, the ones I looked at are written in Kotlin with alternate Java versions.

After a few lines of setup, CameraX commands are fairly straightforward. For example, to simply capture an image from the camera, there is a takePicture() method. Prior to calling it, another simple call lets an application select which camera to use, or to set other parameters. As you’d expect, CameraX requires the app to have CAMERA permissions, and WRITE_EXTERNAL_STORAGE permission on versions of Android prior to Q if you want to capture directly to the file system.

Extending RAW Image Capture to Multi-frame Scenarios

CameraX: Google’s New Weapon in the Photography Wars

CameraX Offers Extensions for HDR, Night, Portrait, and Beauty

CameraX: Google’s New Weapon in the Photography Wars

For an app to have access to an extension, the phone maker needs to add a hook to the CameraX library to the vendor’s own API. If a vendor doesn’t provide an implementation of a capability, CameraX just reports it as being unavailable. Currently, developers using the alpha version of CameraX can make use of extensions on the following phones:

  • Samsung (HDR, Night, Beauty, Auto): Galaxy Note 10 series (pictured, top)(demonstrated at Samsung’s SDC19)
  • Huawei (HDR, Portrait): Mate 20 series, P30 series, Honor Magic 2, Honor View 20

CameraX Rollout

CameraX is currently in alpha, but it’s expected to get to beta status — meaning final APIs according to Google — in December. Samsung showcased its support for CameraX this week at its Software Developer Conference, and it co-hosted a session with Google on how developers can take advantage of both CameraX and its extensions on the latest Samsung phones.

Continue reading

Scientists Confirm the Presence of Water on the Moon
Scientists Confirm the Presence of Water on the Moon

Scientists have confirmed the discovery of molecular water on the moon. Is there any of it in a form we can use? That's less clear.

New Intel Rocket Lake Details: Backwards Compatible, Xe Graphics, Cypress Cove
New Intel Rocket Lake Details: Backwards Compatible, Xe Graphics, Cypress Cove

Intel has released a bit more information about Rocket Lake and its 10nm CPU that's been back-ported to 14nm.

Astronomers Spot Earth-Sized Rogue Planet Wandering the Galaxy
Astronomers Spot Earth-Sized Rogue Planet Wandering the Galaxy

Astronomers have identified more than 4,000 exoplanets orbiting other stars but just a few "rogue planets" wandering the galaxy without a star to call home. A new study claims to have spotted one of these worlds, and it may be a small, rocky world like Earth.

RISC-V Tiptoes Towards Mainstream With SiFive Dev Board, High-Performance CPU
RISC-V Tiptoes Towards Mainstream With SiFive Dev Board, High-Performance CPU

RISC V continues to make inroads across the market, this time with a cheaper and more fully-featured test motherboard.