Review of Android Camera2, Camera Framework API

Everybody likes to take pictures with their phones.  Did you will a free chip while playing casino games on your vacation?  Or maybe your baby did his first smile.  It does not matter.  We all have those precious moments, and we all want to capture them.

There are two parts to photography taking with Android phones, the physical lens and the software, Android Camera API libraries and the GUI to access the library features.

If you want to learn how to properly use your Android Smartphone Camera, I would recommend the course, The Complete Guide To Smartphone Photography published by Wonderium.

Physical Lens

Size of the camera lens

  • 8k video recording requires a 33MP+ camera
  • 4k video recording requires a 8.3MP+ camera
  • 2MP – Prints 5″x4″ (Good quality)
  • 3MP – 7″x5″
  • 4MP – 7.5″x5.5″
  • 5MP – 8.5″x6.4″
  • 6MP – 9.5″x7″
  • 7MP – 10″x7.5″
  • 8MP – 11″x8″
  • 9MP – 11.5″x8.5″
  • 10MP – 12.2″x9.1″
  • 14MP – 11″x14″
  • 28MP – 16″x20″
  • 54MP – 20″x30″

If you use a higher DPI (dots per inch), you do not need as many MP.  The common DPI are 100 DPI (Bad Print Quality), 200 DPI (Poor Print Quality), and 300 DPI (High Print Quality).  I have listed the figures for 300DPI (High Print Quality).  Remember, for viewing the images online, you do not need such high quality.

Camera sizes with multiple cameras

I am not listing specific brands.  I am just listing some possible combinations.  In simple terms, one camera is for “standard pictures”.  The second camera is for panoramic or landscape pictures, and the third camera is for Macro Photography (eg. taking a picture of an insect).   The back camera area is the area that has multiple cameras, and the front camera area only has one camera (selfie pictures).

  • Back cameras: 50MP, 12MP
  • 50MP, 48MP, and 12MP
  • 64MP, 12MP, and 12MP
  • 108MP, 12MP, 10MP and 10MP
  • 50MP, 48MP, 48MP
  • 50MP, 48MP, 8MP, and 2MP

But is having the largest MP in a camera really worth the investment?  I am going to answer, “No”.  The teacher of the Smartphone Photography course uses a Samsung S20 Ultra, which has a 108MP camera.  But the teacher also admits that for a majority of his photographs, he does not go any higher than 24MP (or 28MP if you want to print out a 16″x20″ picture).  So the question is, “Do you need to spend the extra X amount of dollars for pictures that you most likely will never take?”  Only you can answer that question, but I would guess that for a majority of people a 28MP camera lens would be fine.

Android Camera2 API

The software is just as important as the camera, as well as understanding how to use the software.  Do you remember the old film traditional cameras?  Most of use just used a “point and shoot” camera, but it looked closely at your camera you would have noticed a lot of settings (which most of us, who were uneducated about cameras, ignored).

Well, all of those settings (and more) are available on your Android phone.  Now it understanding how to get access to them.

Camera captures sessions and requests

  • Single Capture Request, takes just 1 picture
  • Repeating Capture Request, multiple pictures are taken.  Think, trying to get a picture of a baby smiling.
  • Interleaving Capture Request
RELATED  What Should Be Known About Dogecoin?

Camera Enumeration

  • Lens facing front
  • Lens facing back
  • Lens facing back external, add your own lens through a USB

Most camera apps allow the user to switch between cameras.  With Camera1, only the “first” camera option was available through this button (default camera for front and back).  But with Camera1 API, that button can cycle through all of the cameras.  So if your camera has 3 cameras in the back and 1 in the front, you hit the button 4 times to cycle through all four cameras.

A good Android software app allows the user to easily cycle through all available cameras, including external ones through a USB port.  If a user plugs in an external lens, it is safe to assume that is the lens that the user wants to use as a default lens.  But other lens options should still be available.

Multiple Camera Streams Simultaneously

A camera application can use more than on stream of frames simultaneously.  In some cases, different streams require different frame resolutions.

  • Video recording – One stream to preview, and another stream to record.
  • Barcode scanning – One stream to preview, and another stream for barcode detection.
  • Computational photography – One stream for preview, and other stream for face or scene detection

Camera Output Type

  • JPEG – 8 bit jpg (16.8 million colors, 256 tonal values)
    • With a JPEG, white balance is applied by the camera, and there are fewer options to modify it in post-processing.
    • Lost detail in overexposed highlights cannot be recovered in a JPEG.
    • Shadow detail that is irretrievably lost in a JPEG
  • RAW – 12 bit raw (68.7 billion colors, 4,096 tonal values)
    • Stores more tone and color data
    • With a raw file, you have complete control over white balance when editing the image.
    • In a raw file, even if the highlights appear to be completely white at first, it may be possible to adjust those tones and reveal highlight detail that is still present.
    • Shadow details can often be more successfully recovered in a raw file.
    • Noise reduction can be more effectively applied to a raw file than a JPEG.

Hardware Level

  • Legacy
  • External
  • Limited
  • Full
  • Level 3

Legacy is the lowest level of hardware support.  Every device that supports Camera2 API can output up to 3 simultaneous streams using the right configurations, taking into account overhead processing, memory, CPU, and thermal constraints.

CameraX Architecture

  • Preview – Guaranteed for all cameras
  • Image Analysis – LEVEL_3 (or better) camera device
  • Image Capture – LIMITED (or better) camera device
  • Video Capture – Guaranteed for all cameras

Depending on the capabilities of the camera, some cameras may support the combination at lower resolution modes, but can not support the same combination at some higher resolutions.

CameraX Application Permissions

For an app to use a camera, it will need the following permisions.

  • Camera
  • Write External Storage, except on devices running Android 10 or later.

CameraX Camera Options

  • Camera Limiter  – If your application only uses specific cameras on the device, such as the default front camera, you can set CameraX to ignore other cameras, which can reduce startup latency for the cameras your application uses.
  • If the CameraSelector passed to  CameraXConfig.Builder.setAvailableCamerasLimiter() filters out a camera, CameraX behaves as if that camera does not exist.  Question — Can this option be used by a third party application to prevent Facebook or other apps from using a camera without the end user knowing?  Although, starting in Android 11, third party apps cannot take control of cameras.
  • Automatic selection – best configurations if the user does not override them.
  • Rotation – Most people tend to, by default, take a picture in portrait mode, but it is actually best to get into the habit of taking pictures in landscape mode by default.
  • Crop Rect – By default, the crop rect is the full buffer rect.
  • Camera Selection – Default front camera, Default back camera, filter the list of available devices (including ones plugged in through a USB)
RELATED  IPLWin India - Official company info

CameraX Camera Resolution

  • Automatic Resolution
  • Specify target resolution (eg, 4:3 or 16:9)
  • Specify a custom resolution
  • Specify a cropping aspect

CameraX Control Camera Output

  • Zoom
  • Torch (flashlight)
  • Focus and metering (tap to focus), autofocus, exposure metering, AF/AE/AWB
  • Metering point, which part of the picture do you want to control the focusing of by providing X, Y and Size
  • Exposure compensation, fine tune exposure values, EV, beyond the autoexposure, AE, output result.

CameraX Vendor Extensions

Examples of vendor specific options:

  • Auto – auto adjusts the final image to the surrounding scene.  Retouching of portraits, compensating for low light, and other similar features are included here.
  • Bokeh – Makes the foreground character appear sharper and blurs the background of a photo.
  • Face Retouch – Retouches face skin tone, geometry and so on when taking still images.
  • HDR (High Dynamic Range) – HDR mode takes photos that keep a larger range of scene illumination levels visible in the final image. For example, when taking a picture of an object in front of a bright window, both the object and the scene through the window may be visible when using HDR mode, while in normal mode, one or the other might be poorly exposed.
  • Night – Gets the best still images under low-light situations, typically at night time.

CameraX Transform Output

A drawing a box around the face in a preview.

SmartPhones that were Tested in the Official Android Development Lab

For the complete list: https://developer.android.com/training/camerax/devices

The following is a list of the major smartphone manufacturers that were tested:

  • Google
  • Huawei
  • Motorola
  • Nokia
  • OnePlus
  • Oppo
  • Redmi
  • Samsung
  • Tecno
  • Unimax
  • Vivo
  • Xiaomi

If your smartphone is not on this list, it does not mean that it cannot work with the Camera2 API or the CameraX API.  It just means that the people who wrote the Android operating system did not test it. (last updated on February 15, 2022)

What are the typical settings in a Smartphone Camera?

Although different vendors can add on Software camera features on top of the standard Camera2 API and the CameraX API, there are core features that you will generally be able to find in a descent phone.  The Camera2 API was released in the 4th quarter of 2018.  CameraX was released in May of 2019.

RELATED  Maa 2022 full Movie Free Download HD

So by now, February 2022, most modern phones should have the hardware to be using these APIs.  If the phone’s standard hardware does not have it, then check out one or the brands listed above.  What was considered “the best” in 2019 would be considered “old” by today’s standard, but unless you are a professional photographer where this is your career, then probably any phone on the above list that has the physical lens features you want should be fine.  Note: Not all number value options are listed:

  • Scenes – Presets features for different standard photography conditions (Icon)
    • HDR – 2 to 9 photos taken at different exposure levels and mashed together
    • Action
    • Augmented r…
    • Backlight
    • Beach
    • Candlelight
    • Fireworks
    • Flowers
    • Landscape
    • Night
    • Night portrait
    • Party
    • Portrait
    • Snow
    • Sports
    • Steady photo
    • Sunset
    • Theater
  • Change cameras (Icon), my phone only has 2 lenses
    • Front camera
    • Back camera
  • Picture modifier (Icon)
    • None
    • Mono (black, white, and gray)
    • Sepia, reddish-brown tones
    • Negative
    • Solarize, tone reversal due to overexposure
    • Posterize, decrease the number of colors
    • Aqua, bluish tone to the photo
    • Emboss, raised metallic look
    • Sketch
    • Neon
  • Flash mode (off, auto, on)
  • Store location (off, on)
  • Picture size
    • 13MP, 12MP, 9.7MP 16:9, 7.7MP, 5MP, 3MP, 2.1MP 16:9, 2MP, 1MP
    • WXGA 16:10
    • SVGA Super VGA, resolution of 800 x 600 4-bit pixels or 1024 x 768 8-bit pixels
    • WVGA Wide VGA, 16:9 shape; 1.78:1 aspect ratio
    • VGA Video Graphics Array, 640 x 480 pixels at an aspect ratio of 4:3
    • QVA Quarter VGA, 320 x 240 pixels, a common resolution for phone displays
  • Picture quality (55%, 65% Normal, 75% fine, 85% super fine, 95%, 100%)
  • Countdown timer (off, 1 sec, 3 sec, 10 sec, 30 sec, 60 sec)
  • Face detection (off, on)
  • ISO Sensativity to light (auto, ISO100, ISO200, ISO400, ISO800, ISO1600, ISO3200,
  • Exposure, amount of light per unit area reaching a frame of photographic film (-2, -1, 0, +1, +2)
  • White balance (Incandescent, Flourescent, Auto, Daylight, Cloudy)
  • Focus mode (Audo, Continuous, Infinity, Macro — taking pictures of small objects close up)
  • Touch focus duration (0 sec, 5 sec, 10 sec, Infinity)
  • Shutter speed (Auto, 1/5000, 1/1000, 1/250, 1/60, 1/8, 1/2, 1, 2)
  • Red eye reduction (off, on)
  • Power shutter (off, on)
  • Bright screen (off, on)
  • Histogram, graphic representation of color tones (off, on)
  • Zero shutter lag (off, on)
  • Beep during countdown (off, on)
  • Autofocus zone (auto, spot metering, center weighted, frame average)
  • Saturation (Level 0, Level 5 default, Level 10)
  • Contrast (Level 1, Level 5 default, Level 10)
  • Sharpness (Level 1, Level 2 default, Level 6)
  • Auto exposure (Frame average, Center weighted, Spot metering)
  • Antibanding (Auto, 50Hz Europe, 60Hz USA)
  • Denoise (off, on)

If you do not see the option on your phone that you are looking for, there are two options.  One, it might be a symbol that you do not understand, so talk to a salesperson.  Or two, the option is available in the hardware but not exposed in the software.  Check out 3rd party apps that can provide more options.