Kaur Balw alwinder inder Kaur Senior Member, Technical Staff ON - - PowerPoint PPT Presentation

kaur
SMART_READER_LITE
LIVE PREVIEW

Kaur Balw alwinder inder Kaur Senior Member, Technical Staff ON - - PowerPoint PPT Presentation

Android 5.xs Stream-Based Camera Architecture Kaur Balw alwinder inder Kaur Senior Member, Technical Staff ON Semiconductor Andr ndroid oid Builder uilders Summit ummit | San an Jos ose e | 3.23.15 3.23.15 Tools ools of of the


slide-1
SLIDE 1

Android 5.x’s Stream-Based Camera Architecture

Balw alwinder inder Kaur Kaur

Senior Member, Technical Staff ON Semiconductor

Andr ndroid

  • id Builder

uilder’s Summit ummit | San an Jos

  • se

e | 3.23.15 3.23.15

slide-2
SLIDE 2

2

Tools

  • ols of
  • f the

he Trade ade

slide-3
SLIDE 3

3

Agenda

  • The Basic Idea
  • Enabling New Experiences
  • Camera2 Architecture
  • Camera2 APIs

– Ready. Set. Go!

  • The Other Use Cases
  • The Devil is in the Details
  • Play Store Filters
  • Demo
  • Summary
slide-4
SLIDE 4

The he Bas asic ic Idea dea

Limitations of original Camera Architecture

slide-5
SLIDE 5

5

Limit Limitations ions of

  • f andr

android.har

  • id.hardwar

are.C e.Camer amera

http://source.android.com/devices/camera/camera.html

3 ¡Primary ¡Opera,ng ¡ Modes ¡

  • Preview, Capture & Video

Recording ¡

New Features – hard to implement ¡

  • Burst mode photography ¡
  • Zero Shutter Lag, Multi-Shot

HDR, Panoramic Stitch

No Per-Frame Control ¡

  • Not ¡Possible ¡

No ¡Support ¡for ¡RAW ¡

  • Most products returned null

for the raw callback ¡

Minimal Metadata

  • Support for face detection

data

Primi,ve ¡Custom ¡Se@ngs

  • Through

Camera.Parameters class but no guarantees when the settings would go into effect ¡

slide-6
SLIDE 6

Ena nabling bling New New Exper xperiences iences

slide-7
SLIDE 7

7

Camer amera2 a2 Archit hitect ectur ure e Ena nables bles -

  • Point ¡and ¡Click ¡Camera ¡

Professional ¡Camera ¡ Professional ¡Camera ¡+ ¡Post ¡ Processing ¡on-­‑device ¡ Innova,ve ¡Mobile ¡Camera ¡++ ¡

slide-8
SLIDE 8

8

Fea eatur ures es and and Requir equirement ements

Point ¡and ¡Click ¡

  • Preview ¡
  • S,ll ¡
  • Video ¡Recording ¡

Professional ¡Camera ¡

  • Fine ¡Grained ¡Control ¡of ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Lens, ¡Sensor, ¡Flash ¡

  • RAW ¡Sensor ¡Output ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡with ¡capture ¡metadata ¡ Computa4onal ¡Photography ¡

  • Individual ¡Frame ¡Control ¡
  • Algorithms ¡ ¡& ¡Compute ¡

Power ¡ ¡

  • HDR, ¡Focus ¡Stacking, ¡

Exposure ¡Bracke,ng ¡ ¡ Innova4ve ¡Mobile ¡Cameras ¡

  • Sensors ¡
  • Loca,on ¡
  • Connec,vity/Cloud ¡Power ¡
  • Compute ¡Power ¡
slide-9
SLIDE 9

9

andr android.har

  • id.hardwar

are.camer e.camera2 a2

  • Enables Professional Quality Photography

– Think DSLR instead of Point-and-Shoot

  • Enables Access to RAW Images
  • Enables On-device processing of Camera Data

– High Dynamic Range, Focus Stacking

  • Enables New Use Cases combining Imaging with

– Rich Sensor input

  • Inertial sensors, altitude et. al.

– Compute Power

  • Multi-core CPU & GPU

– Connectivity

  • Power of the Cloud & Access to Proximity (BLE, NFC)

– Context

  • Location & User History

Major ¡ Limita,on-­‑ ¡ Op,cs ¡

DSLR++ ¡? ¡ ¡ Computa,onal ¡Photography ¡

slide-10
SLIDE 10

10

Prof

  • fes

essional ional Qualit Quality Phot hotog

  • graphy

phy

  • Fine grained control of the

– Sensor – Flash – Lens – Image Signal Processing Pipeline

  • Control on a per-frame basis, and deterministic behavior
  • Processing Images at full resolution and full frame rate(30 fps)
  • Meta data

– Every frame is returned with the actual settings that it was taken with, and requested for.

Professional ¡Camera ¡

slide-11
SLIDE 11

11

Comput

  • mputational

ional Phot hotog

  • graphy

phy

Definition

  • Computational photography refers to computational image capture,

processing, and manipulation techniques that enhance or extend the capabilities of digital photography. Source: Wikipedia

Professional ¡Camera ¡+ ¡ Post ¡Processing ¡on-­‑device ¡

slide-12
SLIDE 12

12

Mult ulti i Shot hot HD HDR

  • HDR = High Dynamic Range
  • Multiple shots at different exposures and then blended together

Computa,onal ¡ Photography ¡

slide-13
SLIDE 13

13

Panor anoramic amic Stit itching hing

Source: commons.wikimedia.org Computa,onal ¡ Photography ¡

Multiple Images with orientation information and fixed Exposure

slide-14
SLIDE 14

14

Flas lash h No-F No-Flas lash h Phot hotog

  • graphy

phy

Source: ¡MicrosoW ¡Research ¡ Computa,onal ¡ Photography ¡

slide-15
SLIDE 15

15

Flas lash h No-F No-Flas lash h Phot hotog

  • graphy

phy

Source: Microsoft Research

Computa,onal ¡ Photography ¡

  • Take 2 shots of the scene– one

with flash on, the other with flash off

  • Computationally blend the 2

frames together

slide-16
SLIDE 16

16

Focus

  • cus Stac

acking king

Source: Wikipedia Focus Stacking for macro photography. Also known as – all-in-focus photography

Computa,onal ¡ Photography ¡

slide-17
SLIDE 17

17

View iew Finder Finder

  • Today’s smartphones

enable features like

– Touch to Expose & Touch to Focus

  • Computational

Photography can take it to the next level

– Edit the frame in the view finder by selecting areas to sharpen, blur, brighten and maintain these during capture mode

Source: SIGGRAPH 2012

Computa,onal ¡ Photography ¡

slide-18
SLIDE 18

18

Mobile

  • bile Embed

mbedded ded Vis ision ion Applica pplications ions

  • Gesture Recognition
  • Face Recognition, Object Tracking
  • Visual Search
  • 3D Mapping of the environment
  • Augmented Reality

Natural ¡User ¡Interface ¡ Companies ¡are ¡using ¡the ¡Front ¡ Facing ¡Camera ¡to ¡provide ¡ gesture ¡recogni,on ¡solu,ons. ¡ ¡ ¡

slide-19
SLIDE 19

19

Inno nnovativ ive e Mobile

  • bile Camer

amera a ++

You ¡

Fine ¡Grained ¡ Control ¡ Lens, ¡Sensor, ¡Flash ¡ Cloud ¡ Compu,ng ¡ On-­‑Device ¡ Compute ¡ Power ¡ Sensors ¡ Loca,on ¡ User ¡History ¡ User ¡Preferences ¡

slide-20
SLIDE 20

Camer amera2 a2 Archit hitect ectur ure e

slide-21
SLIDE 21

21

Limit Limitations ions of

  • f andr

android.har

  • id.hardwar

are.C e.Camer amera

http://source.android.com/devices/camera/camera.html

3 ¡Primary ¡Opera,ng ¡Modes ¡ New Features – hard to implement ¡ No Per-Frame Control ¡ No ¡Support ¡for ¡RAW ¡ Minimal Metadata Custom ¡Se@ngs

slide-22
SLIDE 22

22

Camer amera2 a2 Cor

  • re

e Oper Operation ion Model

  • del

http://source.android.com/devices/camera/camera.html

  • Per Frame Settings
  • The Settings travel with individual

requests and are no longer globally applied

  • Image buffer delivered to all

configured and requested Surfaces

  • Metadata returned back to the

application as requested separately

  • Multiple requests and results in

queue simultaneously

slide-23
SLIDE 23

23

Camer amera3 a3 HA HAL L Model

  • del

http://source.android.com/devices/camera/camera.html

slide-24
SLIDE 24

The he Camer amera a APIs

slide-25
SLIDE 25

25

Andr ndroid

  • id Lollipop

Lollipop

Camera related classes and interfaces from android.hardware deprecated 2 new packages android.hardware.camera2 android.hardware.camera2.params 25+ classes, 1 Exception

slide-26
SLIDE 26

26

Camer amera a Model

  • del

From the Javadoc “This package models a camera device as a pipeline, which takes in input requests for capturing a single frame, captures the single image per the request, and then outputs one capture result metadata packet, plus a set of output image buffers for the request. The requests are processed in-order, and multiple requests can be in flight at once. Since the camera device is a pipeline with multiple stages, having multiple requests in flight is required to maintain full frame-rate on most Android devices.”

slide-27
SLIDE 27

27

Archit hitect ectur ure e walk alk thr hrough

  • ugh for
  • r pr

primar imary us use e cas cases es

Live ¡ Preview ¡ S,ll ¡Capture ¡ (JPG) ¡ S,ll ¡Capture ¡ (RAW/DNG) ¡ S,ll ¡Capture ¡ (Burst) ¡ Video ¡ Recording ¡

slide-28
SLIDE 28

Ready eady. . Set et. . Go! Go!

Figure out what’s available

slide-29
SLIDE 29

29

Concept

  • ncepts and

and Ter erms ms from

  • m Camer

amera a 2 2

  • Camera Device
  • Streams
  • Capture Session
  • Target Surfaces

It’s ¡a ¡ paradigm ¡ ¡ s ¡h ¡ ¡i ¡ ¡ ¡f ¡ ¡ ¡ ¡t ¡! ¡

  • Capture Request
  • Capture Result

– Image Data – Metadata – Total Capture Result

slide-30
SLIDE 30

30

1.

  • 1. Ho

How many many Camer ameras as do do I ha have? e?

Query the System for capabilities CameraManager provides information on the number of available cameras, or CameraDevices.

CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); String[] camids = manager.getCameraIdList();

slide-31
SLIDE 31

31

2.

  • 2. Wha

hat kind kind of

  • f a

a Camer ameraD aDevice ice is is it it?

CameraCharacteristics provide static metadata for a given

  • CameraDevice. This information is immutable for a given camera.

CameraCharacteristics characteristics = manager.getCameraCharacteristics(camid); CameraCharacteris,cs ¡Keys ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡INFO_SUPPORTED_HARDWARE_LEVEL ¡ 3 ¡Classes ¡of ¡Cameras ¡are ¡supported ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

LEGACY ¡ LIMITED ¡ FULL ¡

Additionally, RAW may be supported ① FULL + RAW ② LIMITED + RAW

slide-32
SLIDE 32

32

3.

  • 3. Ho

How many many maximum maximum streams eams does does the he system em suppor upport?

PROCESSED ¡& ¡ NON_STALLING ¡ (like ¡YUV) ¡ PROCESSED ¡& ¡ STALLING ¡ (like ¡JPEG) ¡ RAW ¡ FULL ¡ >=3 ¡ >=1 ¡ >=0 ¡ LIMITED ¡ >=2 ¡ >=1 ¡ >=0 ¡ LEGACY ¡ >=2 ¡ >=1 ¡ 0 ¡

3 Classes of Streams

① Processed & Non-Stalling ② Processed & Stalling ③ RAW (Bayer Domain)

The Maximum Number of Streams = REQUEST_MAX_NUM_OUTPUT_PROC1 + REQUEST_MAX_NUM_OUTPUT_PROC_STALLING1 + REQUEST_MAX_NUM_OUTPUT_RAW1

1 ¡CameraCharacteris,cs.Key ¡

¡

slide-33
SLIDE 33

33

Guar Guarant anteed eed Stream eam Conf

  • nfigur

igurations ions -

  • LE

LEGA GACY

Target ¡1 ¡ Target ¡2 ¡ Target ¡3 ¡ Type ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ PRIV1 ¡ Maximum2 ¡ JPEG ¡ Maximum ¡ YUV ¡ Maximum ¡ PRIV ¡ Preview ¡ JPEG ¡ Maximum ¡ YUV ¡ Preview ¡ JPEG ¡ Maximum ¡ PRIV ¡ Preview ¡ PRIV ¡ Preview ¡ PRIV ¡ Preview ¡ YUV ¡ ¡ Preview ¡ PRIV ¡ Preview ¡ YUV ¡ Preview ¡ JPEG ¡ ¡ Maximum ¡

1 ¡Device ¡Opaque ¡Format, ¡No ¡Visibility ¡into ¡Format ¡for ¡Applica,on ¡ 2 ¡Device ¡Maximum ¡Sensor ¡Output ¡

S,ll ¡capture ¡plus ¡in-­‑app ¡processing. ¡

slide-34
SLIDE 34

34

Guar Guarant anteed eed Stream eam Conf

  • nfigur

igurations ions -

  • LI

LIMITED

Target ¡1 ¡ Target ¡2 ¡ Target ¡3 ¡ Type ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ PRIV ¡ Preview ¡ PRIV ¡ Record ¡1 ¡ PRIV ¡ Preview ¡ YUV ¡ Record ¡ YUV ¡ Preview ¡ YUV ¡ Record ¡ PRIV ¡ Preview ¡ PRIV ¡ Record ¡ JPEG ¡ Record ¡ PRIV ¡ Preview ¡ YUV ¡ Record ¡ JPEG ¡ Record ¡ YUV ¡ Preview ¡ YUV ¡ Preview ¡ JPEG ¡ Maximum ¡

1 ¡Maximum ¡resolu,on ¡supported ¡by ¡the ¡device ¡for ¡media ¡recording ¡ ¡

slide-35
SLIDE 35

35

Guar Guarant anteed eed Stream eam Conf

  • nfigur

igurations ions -

  • FULL

FULL

Target ¡1 ¡ Target ¡2 ¡ Target ¡3 ¡ Type ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ PRIV ¡ Preview ¡ PRIV ¡ Maximum ¡ PRIV ¡ Preview ¡ YUV ¡ Maximum ¡ YUV ¡ Preview ¡ YUV ¡ Maximum ¡ PRIV ¡ Preview ¡ PRIV ¡ Preview ¡ JPEG ¡ Maximum ¡ YUV ¡ 640x480 ¡ PRIV ¡ Preview ¡ YUV ¡ Maximum ¡ YUV ¡ 640x480 ¡ YUV ¡ Preview ¡ YUV ¡ Maximum ¡

slide-36
SLIDE 36

36

Guar Guarant anteed eed Stream eam Conf

  • nfigur

igurations ions -

  • RAW

W

Target ¡1 ¡ Target ¡2 ¡ Target ¡3 ¡ Type ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ Type ¡ ¡ Max ¡Size ¡ RAW ¡ Maximum ¡ PRIV ¡ Preview ¡ RAW ¡ Maximum ¡ YUV ¡ Preview ¡ RAW ¡ Maximum ¡ PRIV ¡ Preview ¡ PRIV ¡ Preview ¡ RAW ¡ Maximum ¡ PRIV ¡ Preview ¡ YUV ¡ Preview ¡ RAW ¡ Maximum ¡ YUV ¡ Preview ¡ YUV ¡ Preview ¡ RAW ¡ Maximum ¡ PRIV ¡ Preview ¡ JPEG ¡ Maximum ¡ RAW ¡ Maximum ¡ YUV ¡ Preview ¡ JPEG ¡ Maximum ¡ RAW ¡ Maximum ¡ In-­‑app ¡processing ¡with ¡simultaneous ¡JPEG ¡and ¡DNG. ¡

slide-37
SLIDE 37

37

4.

  • 4. Ho

How can can thes hese e streams eams be be conf configur igured? ed?

CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(cameraId); StreamConfigurationMap configs = characteristics.get( CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); StreamConfigurationMap provides information on

  • Supported Stalling and Non-Stalling Image Formats
  • Supported Image Sizes for Supported Image Formats
  • Supported Video Sizes and fps(frames per Second) Speeds
  • Minimum Frame Duration and Stall Duration for supported formats and sizes
  • Determine whether a given Surface is supported by this CameraDevice or not
slide-38
SLIDE 38

38

FULL FULL Camer amera a Devices ices

30 ¡FPS ¡at ¡ ¡ sensor ¡max ¡resolu,on ¡

more ¡than ¡20fps ¡is ¡required ¡

Per ¡Frame ¡Control ¡

android.sync.maxLatency ¡ PER_FRAME_CONTROL ¡ ¡

Manual ¡Sensor ¡Control ¡ Manual ¡Post ¡Processing ¡ Control ¡

android.request.availableCapabili,es ¡

Arbitrary ¡Cropping ¡ Region ¡

android.scaler.croppingType ¡== ¡ FREEFORM ¡

Minimum ¡3 ¡Processed ¡ Non-­‑Stalling ¡Output ¡ Streams ¡ (think ¡YUV) ¡ ¡

Stream ¡Configura,ons ¡ Available ¡

as ¡a ¡Configura,on ¡Map ¡

slide-39
SLIDE 39

39

LI LIMITED and and LE LEGA GACY Camer amera a Device ice

LEGACY ¡

  • NO ¡Per-­‑ ¡Frame ¡Control ¡
  • NO ¡Manual ¡Sensor ¡Control ¡
  • NO ¡Manual ¡Post ¡Processing ¡
  • NO ¡Arbitrary ¡Cropping ¡Regions ¡
  • No ¡Stringent ¡Performance ¡Constraints ¡
  • Not ¡a ¡candidate ¡for ¡a ¡Superior ¡Camera ¡Experience ¡

LIMITED ¡

  • ¡Query ¡for ¡individual ¡capabili,es! ¡

LEGACY ¡ LIMITED ¡ FULL ¡

That’s ¡ a ¡lot ¡of ¡ checks! ¡

① FULL + RAW ② LIMITED + RAW

slide-40
SLIDE 40

Ready eady. . Set

  • et. Go!

Go!

Open the Camera

slide-41
SLIDE 41

41

1.

  • 1. Open

Open a a Full Full Camer amera a Device ice

① Use the instance of the CameraManager to open a Camera passing in its camera id. ② Get a handle to a CameraDevice via the CameraDevice.StateCallback method when it is successfully

  • pened.

CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback () { …}; manager.openCamera(camid, mStateCallback, ..);

slide-42
SLIDE 42

42

2.

  • 2. Crea

eate e a a Capt ptur ure e Ses ession ion

  • Expensive Operation

– Involves allocation of buffers beneath the HAL – May take up to several hundred milliseconds

  • All modes cannot be supported concurrently

– so Sessions may have to be torn down and setup again. CameraCaptureSession.StateCallback mCaptureCallback= new CameraCaptureSession.StateCallback () {...}; List<Surface> outputs = new ArrayList<Surface>(...); createCaptureSession (outputs, mCaptureCallback, ...); // a handle to a capture session in mCaptureCallback method Minimize ¡calls ¡to ¡ createCaptureSession ¡ Failure ¡to ¡create ¡a ¡capture ¡session ¡may ¡result ¡in ¡excep,ons ¡being ¡thrown ¡ ¡

slide-43
SLIDE 43

43

Dif iffer erent ent Tar arget get Out Output put Streams eams

slide-44
SLIDE 44

44

3.

  • 3. Crea

eate e a a Capt ptur ure e Reques equest

① Pick the Capture Request Template

  • TEMPLATE_PREVIEW
  • TEMPLATE_STILL_CAPTURE
  • TEMPLATE_VIDEO_SNAPSHOT
  • TEMPLATE_RECORD
  • TEMPLATE_MANUAL

CaptureRequest.Builder mPreviewBuilder = mCameraDevice .createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);

slide-45
SLIDE 45

45

3.

  • 3. Crea

eate e a a Capt ptur ure e Reques equest – – cont contd. d.

mPreviewBuilder.addTarget(mPreviewSurface); //where mPreviewSurface is a Surface initialized to the width and height of the Preview Desired ② Pick an appropriate target output

  • e.g. TextureView for the correct width/height for Preview

③ Pick the Frequency of the Capture Request

  • capture
  • captureBurst
  • setRepeatingRequest
  • setRepeatingBurst
  • stopRepeating
  • abortCaptures()
slide-46
SLIDE 46

Ready eady. . Set et. . Go! Go!

Get your pictures

slide-47
SLIDE 47

47

Receiv eceiving ing Ima mage ge and and Met etada adata a

  • The Image data is typically received in a listener associated with the

Output Surface.

  • The Metadata is received in the onCaptureCompleted callback

method of CameraCaptureSession.CaptureCallback via the TotalCaptureResult object.

How ¡does ¡the ¡ metadata ¡,e ¡to ¡ the ¡correct ¡image ¡ data ¡frame? ¡ Through ¡the ¡Time ¡Stamp! ¡ CaptureResult.SENSOR_TIMESTAMP ¡ & ¡image.getTimestamp() ¡

mSession.setRepeatingRequest(mPreviewBuilder.build(), listener,backgroundHandler);

slide-48
SLIDE 48

The he Ot Other her Us Use e Cas ases es

slide-49
SLIDE 49

49

Still ill Capt ptur ure e -

  • JP

JPEG G

① Use TEMPLATE_STILL_CAPTURE for the CaptureRequest ② Create an ImageReader object with format == ImageFormat.JPEG ③ Pick CameraCaptureSession.capture for the frequency of capture ④ Image Data is received in the ImageReader.onImageAvailableListener ⑤ Metadata is received in the CameraCaptureSession.CaptureCallback.

  • nCaptureCompleted callback
slide-50
SLIDE 50

50

Still ill Capt ptur ure e -

  • RAW

W

① Use TEMPLATE_STILL_CAPTURE for the CaptureRequest ② Create an ImageReader object with format == ImageFormat.

ImageFormat.RAW_SENSOR

③ Pick CameraCaptureSession.capture for the frequency of capture ④ Image Data is received in the ImageReader.onImageAvailableListener ⑤ Metadata is received in the CameraCaptureSession.CaptureCallback.onCaptureCompleted callback ⑥ Use an instance of DngCreator to convert RAW to DNG (Digital Negative)

final File dngFile = new File(path, filename);

  • uts = new FileOutputStream(dngFile);

if (mRawTotalResult != null) { DngCreator d = new DngCreator(characteristics, mRawTotalResult); d.writeImage(outs, image); }

slide-51
SLIDE 51

51

Still ill Capt ptur ure e -

  • BUR

URST

① Use TEMPLATE_STILL_CAPTURE for the CaptureRequest ② Create an ImageReader object with format == ImageFormat.

ImageFormat.JPEG

③ Pick CameraCaptureSession.captureBurst for the frequency of capture ④ Image Data is received in the ImageReader.onImageAvailableListener ⑤ Metadata is received in the CameraCaptureSession.CaptureCallback.

  • nCaptureCompleted callback
slide-52
SLIDE 52

52

Video ideo Recor ecording ding

① Use TEMPLATE_RECORD for the CaptureRequest ② Create a MediaRecorder Object and use its surface as the output stream ③ Pick CameraCaptureSession.setRepeatingRequest for the frequency of capture ④ Image Data is recorded in the Image file set via MediaRecorder.setOutputFile call. ⑤ Metadata is received in the CameraCaptureSession.CaptureCallback.

  • nCaptureCompleted callback
slide-53
SLIDE 53

53

In-A n-App pp Proces

  • cessing

ing of

  • f Camer

amera a Data a

① Use an appropriate Template for the CaptureRequest; including TEMPLATE_MANUAL if the use case so demands ② Create an object like Allocation Renderscript, ImageReader (with Format YUV_420_888), SurfaceTexture, or GLSurfaceView that provides a Surface ③ Pick an appropriate frequency for capture ④ Image Data can be found in an appropriate callback for the surface chosen ⑤ Metadata is received in the CameraCaptureSession.CaptureCallback.

  • nCaptureCompleted callback
slide-54
SLIDE 54

54

Some

  • me us

use e cas cases es for

  • r In-A

n-App pp Proces

  • cessing

ing

  • Use Cases

– Filters – Computational Photography Use cases – Custom Post Processing of the Imaging Pipeline – Computer Vision Applications

  • Uses

– Compute Framework

  • Renderscript, OpenCL

– Low level Graphics APIs

  • OpenGL ES
slide-55
SLIDE 55

55

And nd then hen ther here e was as Met etada adata… a…

CameraMetadata Controls

CaptureRequest

Information Static Metadata

Fixed for a given CameraDevice

CameraCharacteristics

Dynamic Metadata

Settings associated with each frame CaptureResult

Key ¡Value ¡Pairs ¡for ¡Hardware ¡Control ¡(Lens, ¡Sensor, ¡Flash), ¡Image ¡ Processing ¡Pipeline, ¡Control ¡Algorithms ¡and ¡Output ¡Buffers ¡

slide-56
SLIDE 56

Fine Fine Gr Grained ained Cont

  • ntrol
  • l

a.k.a “The Devil is in the Details”

slide-57
SLIDE 57

57

Manual anual Sens ensor

  • r Cont
  • ntrol
  • l

Sensor ¡

Sensi,vity ¡ (Gain/ISO) ¡ Sensor ¡ Exposure ¡Time ¡ Sensor ¡Frame ¡ Dura,on ¡

Flash ¡ (if ¡present) ¡

Flash ¡ Mode ¡

Lens ¡ (if ¡adjustable) ¡

Lens ¡ ¡Aperture ¡ Lens ¡Filter ¡Density ¡ Lens ¡Focal ¡Length ¡ Lens ¡Focus ¡Distance ¡

Black ¡Level ¡ Lock ¡

Black ¡ Level ¡ Lock ¡ On/Off ¡

slide-58
SLIDE 58

58

Manual anual 3A 3A Cont

  • ntrol
  • l
  • A Camera Request can override the 3A Algorithm Controls

– Auto Exposure (AE) – Auto Focus(AF) – Auto White Balance (AWB)

  • There is an overall control for all Auto Algorithms

android.control.mode – When set to OFF, application has full control of the pipeline – When set to AUTO, the individual controls are in effect

slide-59
SLIDE 59

59

Applica pplication ion Cont

  • ntrolled
  • lled (Aut

uto)

  • ) Algor

lgorit ithms hms

Auto ¡Focus ¡

  • Applica,on ¡uses ¡android.lens.focusDistance ¡to ¡control ¡the ¡Lens ¡

Auto ¡Exposure ¡

  • Applica,on ¡uses ¡android.sensor.exposureTime, ¡android.sensor.sensi,vity ¡

and ¡android.sensor.frameDura,on ¡+ ¡android.flash.* ¡to ¡control ¡exposure ¡ Auto ¡White ¡Balance ¡

  • Applica,on ¡uses ¡android.colorCorrec,on.transform ¡& ¡

android.colorCorrec,on.gains ¡to ¡control ¡the ¡white ¡balance ¡

android.control.mode= AUTO android.control.a*mode = OFF

slide-60
SLIDE 60

60

Manual anual Pos

  • st Proces
  • cessing

ing

http://source.android.com/devices/camera/camera.html

slide-61
SLIDE 61

61

Hot ¡Pixel ¡ Mode ¡ Black ¡Level ¡ Correc,on ¡ Demosaic ¡ Noise ¡ Reduc,on ¡ Mode ¡ Shading ¡Mode ¡ (lens ¡shading) ¡ Color ¡ Correc,on ¡ Mode ¡ Tone ¡Curve ¡ Adjustment ¡ Edge ¡ Enhancement ¡

Ima mage ge Proces

  • cessing

ing Pipeline ipeline

slide-62
SLIDE 62

62

Manual anual Pos

  • st Proces
  • cessing

ing

Manual ¡Tonemap ¡control ¡

  • android.tonemap.* ¡

Manual ¡White ¡Balance ¡control ¡

  • android.colorCorrec,on.* ¡

Manual ¡Lens ¡Shading ¡map ¡control ¡

  • android.shading.* ¡

Manual ¡aberra,on ¡correc,on ¡control ¡(if ¡supported) ¡

  • android.colorCorrec,on.aberra,on.* ¡
slide-63
SLIDE 63

63

The he ot

  • ther

her camer camera2 a2 pac packa kage ge andr android.har

  • id.hardwar

are.camer e.camera2.par a2.params ams

  • BlackLevelPattern
  • ColorSpaceTransform
  • Face
  • LensShadingMap
  • MeteringRectangle
  • RggbChannelVector
  • StreamConfigurationMap
  • TonemapCurve
slide-64
SLIDE 64

Play lay Stor

  • re

e Fea eatur ure e Filt Filter ers

Android Manifest <uses-feature>

slide-65
SLIDE 65

65

Play lay Stor

  • re

e Fea eatur ure e Filt Filter ers

  • android.hardware.camera.hardware_level.full
  • android.hardware.camera.capability.raw
  • android.hardware.camera.capability.manual_sensor
  • android.hardware.camera.capability.manual_post_processing

See Also: Versioning

slide-66
SLIDE 66

Demo emo Time ime

slide-67
SLIDE 67

Summar ummary

slide-68
SLIDE 68

68

Its all all about bout you

  • u and

and your

  • ur po

power er tools

  • ols!

!

You ¡

Fine ¡Grained ¡ Control ¡ Lens, ¡Sensor, ¡Flash ¡ Cloud ¡ Compu,ng ¡ On-­‑Device ¡ Compute ¡ Power ¡ Sensors ¡ Loca,on ¡ User ¡History ¡ User ¡Preferences ¡

slide-69
SLIDE 69

69

Q & A A

and THANK YOU for your time.

Balwinder Kaur

balwinder.kaur@onsemi.com balwinder.x.kaur@gmail.com

http://www.slideshare.net/lbk003 https://github.com/lbk003