# android/camera-samples

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/android-camera-samples).**

5,422 stars · 2,418 forks · Kotlin · Apache-2.0

## Links

- GitHub: https://github.com/android/camera-samples
- awesome-repositories: https://awesome-repositories.com/repository/android-camera-samples.md

## Topics

`kotlin` `samples`

## Description

A collection of reference implementations and code samples for integrating Android camera hardware and software APIs. The project provides demonstrations for using both the Jetpack CameraX library and the low-level Camera2 API to implement photo and video capture features.

The repository includes specialized implementations for high-performance recording, such as high-frame-rate slow motion and high-dynamic-range video. It also features examples of machine learning vision, demonstrating how to analyze live camera frames for object detection and QR code scanning.

The project covers broad imaging capabilities, including still image acquisition, live viewfinder rendering, and video quality configuration. It further details the use of manufacturer-specific hardware extensions to apply effects like bokeh, night mode, and HDR.

The samples include utilities for coordinate mapping to render visual overlays and event monitoring to track recording states.

## Tags

### Mobile Development

- [Camera Integrations](https://awesome-repositories.com/f/mobile-development/camera-integrations.md) — Provides comprehensive reference implementations for integrating Android camera hardware to capture photos and videos.
- [Camera API Implementations](https://awesome-repositories.com/f/mobile-development/camera-api-implementations.md) — Provides architectural best practices and utility tools to reduce boilerplate when implementing Android camera features.
- [Camera2 API References](https://awesome-repositories.com/f/mobile-development/camera2-api-references.md) — Provides examples for utilizing the low-level Camera2 API to control fine-grained hardware settings and manual image capture.
- [CameraX API Implementations](https://awesome-repositories.com/f/mobile-development/camerax-api-implementations.md) — Provides code samples for using the Jetpack CameraX library to build photo and video capture features.
- [Video Profile Configuration](https://awesome-repositories.com/f/mobile-development/mobile-capabilities/camera-integration/camera-feed-capture/camera-capture-controllers/video-profile-configuration.md) — Sets the dimensions, frame rate, and color format based on the hardware capabilities of the device. ([source](https://github.com/android/camera-samples/tree/main/Camera2Video))
- [Image Capture](https://awesome-repositories.com/f/mobile-development/mobile-capabilities/content-capture/image-capture.md) — Captures still images in standard or raw formats to preserve unprocessed sensor data. ([source](https://github.com/android/camera-samples/blob/main/Camera2Basic))
- [Manufacturer Hardware Extensions](https://awesome-repositories.com/f/mobile-development/mobile-capabilities/camera-integration/camera-feed-capture/advanced-mobile-camera-controls/manufacturer-hardware-extensions.md) — Demonstrates how to use manufacturer-specific extensions to apply professional effects such as bokeh, night mode, and HDR.
- [Hardware Extension Effects](https://awesome-repositories.com/f/mobile-development/mobile-capabilities/camera-integration/camera-feed-capture/camera-capture-controllers/hardware-extension-effects.md) — Applies manufacturer-specific enhancements like Bokeh, HDR, or Night mode to still image captures. ([source](https://github.com/android/camera-samples#readme))
- [Enhanced Image Captures](https://awesome-repositories.com/f/mobile-development/mobile-capabilities/content-capture/image-capture/enhanced-image-captures.md) — Captures enhanced still images by leveraging hardware-specific camera extensions through a system interface. ([source](https://github.com/android/camera-samples/blob/main/Camera2Extensions))
- [Mobile Video Recording](https://awesome-repositories.com/f/mobile-development/mobile-video-recording.md) — Records high-dynamic-range video when the hardware supports the capability. ([source](https://github.com/android/camera-samples/blob/main/Camera2Video))

### Artificial Intelligence & ML

- [Real-Time Object Detection](https://awesome-repositories.com/f/artificial-intelligence-ml/computer-vision-systems/computer-vision/object-detection-tracking/real-time-object-detection.md) — Provides reference implementations for identifying and tracking objects within live camera streams using machine learning. ([source](https://github.com/android/camera-samples/tree/main/CameraXAdvanced))
- [Real-Time Frame Processors](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/machine-learning-concepts/domain-specific-modeling/computer-vision-modelings/real-time-frame-processors.md) — Implements components that intercept live camera frames to perform real-time detection and analysis using machine learning models. ([source](https://github.com/android/camera-samples#readme))
- [Mobile Vision Implementations](https://awesome-repositories.com/f/artificial-intelligence-ml/mobile-vision-implementations.md) — Provides sample code for analyzing live camera frames using ML models for object detection and QR code scanning.
- [Bounding Box Visualizers](https://awesome-repositories.com/f/artificial-intelligence-ml/bounding-box-regression/bounding-box-representations/bounding-box-visualizers.md) — Includes utilities for overlaying detection coordinates as bounding boxes onto the live camera preview. ([source](https://github.com/android/camera-samples/tree/main/CameraX-MLKit))

### Graphics & Multimedia

- [Video Encoders](https://awesome-repositories.com/f/graphics-multimedia/image-encoders/gpu-accelerated-encoders/video-encoders.md) — Streams raw camera frames into a media encoder to produce compressed video files for local storage.
- [Real-Time Model Inference on Frames](https://awesome-repositories.com/f/graphics-multimedia/video-frame-processing/real-time-model-inference-on-frames.md) — Processes live camera frames for real-time object detection, QR code scanning, and machine learning inference.
- [Concurrent Capture Sessions](https://awesome-repositories.com/f/graphics-multimedia/concurrent-capture-sessions.md) — Manages a single hardware session that simultaneously routes data to a screen preview and a file recorder.
- [HDR Viewfinder Rendering](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/3d-graphics-pipelines/scene-renderers/high-quality-scene-rendering/high-dynamic-range-rendering/hdr-image-processors/hdr-viewfinder-rendering.md) — Composites alternating short and long exposure frames in real time to produce high-dynamic-range previews. ([source](https://github.com/android/camera-samples/tree/main/HdrViewfinder))
- [High-Performance Video Capture](https://awesome-repositories.com/f/graphics-multimedia/high-performance-video-capture.md) — Implements high-speed slow-motion recording and high-dynamic-range video capture using Android hardware.
- [High-Frame-Rate Capture](https://awesome-repositories.com/f/graphics-multimedia/slow-motion-video-generation/high-frame-rate-capture.md) — Provides reference guides for recording high-frame-rate video sessions to enable slow-motion playback.
- [HDR Video Capture](https://awesome-repositories.com/f/graphics-multimedia/video-encoding-and-decoding/android-video-encoding-guides/hdr-video-capture.md) — Demonstrates the capture of high dynamic range video and the rendering of real-time HDR viewfinders.
- [High Frame Rate Recording](https://awesome-repositories.com/f/graphics-multimedia/video-frame-capture/high-frame-rate-recording.md) — Records high-speed video within a constrained capture session to create smooth slow-motion playback. ([source](https://github.com/android/camera-samples#readme))
- [Exposure Compositing](https://awesome-repositories.com/f/graphics-multimedia/video-frame-processing/real-time-frame-displays/frame-manipulation/exposure-compositing.md) — Merges short and long exposure frames in real time to create a high-dynamic-range viewfinder.
- [Screen Space Coordinate Mappings](https://awesome-repositories.com/f/graphics-multimedia/visualization-mapping/visualization-frameworks/coordinate-systems/page-coordinate-mapping/screen-space-coordinate-mappings.md) — Translates raw camera sensor coordinates into screen pixel coordinates to render visual bounding boxes over a live preview.

### Operating Systems & Systems Programming

- [Camera and Video Capture](https://awesome-repositories.com/f/operating-systems-systems-programming/raspberry-pi-systems-programming/camera-and-video-capture.md) — Captures video frames using repeating requests and encodes them into a standard video file. ([source](https://github.com/android/camera-samples/blob/main/Camera2Video))
- [Repeating Capture Loops](https://awesome-repositories.com/f/operating-systems-systems-programming/repeating-capture-loops.md) — Issues continuous capture requests to the camera hardware to maintain a steady stream of frames for preview and recording.

### Software Engineering & Architecture

- [Android Lifecycle Management](https://awesome-repositories.com/f/software-engineering-architecture/memory-usage-analysis/memory-leak-prevention/android-lifecycle-management.md) — Uses Android-specific lifecycle-aware components to automate the opening and closing of camera hardware resources.
- [Frame Memory Buffers](https://awesome-repositories.com/f/software-engineering-architecture/memory-buffering/frame-memory-buffers.md) — Implements buffers that maintain video frames to facilitate real-time machine learning inference and QR scanning.

### User Interface & Experience

- [Camera Preview Embeddings](https://awesome-repositories.com/f/user-interface-experience/programmatic-element-construction/android-view-lifecycle-tracking/custom-view-rendering/camera-preview-embeddings.md) — Renders a real-time camera feed to a view with options for stabilization and portrait filters. ([source](https://github.com/android/camera-samples/blob/main/Camera2Basic))
- [Android Camera API Examples](https://awesome-repositories.com/f/user-interface-experience/programmatic-element-construction/android-view-lifecycle-tracking/custom-view-rendering/camera-preview-embeddings/android-camera-api-examples.md) — Offers a comprehensive set of reference implementations demonstrating best practices for Android camera API integration.

### Part of an Awesome List

- [Camera QR Code Scanners](https://awesome-repositories.com/f/awesome-lists/devtools/qr-codes/camera-qr-code-scanners.md) — Detects QR codes within a camera stream and extracts encoded data to trigger specific actions. ([source](https://github.com/android/camera-samples/blob/main/CameraX-MLKit))
- [Hardware Vendor Abstractions](https://awesome-repositories.com/f/awesome-lists/devtools/vendor-abstraction-libraries/hardware-vendor-abstractions.md) — Provides a standardized interface to access manufacturer-specific hardware processing pipelines for bokeh and night mode.

### Data & Databases

- [Local File Storage](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-persistence-storage/data-storage/file-based-storage/local-file-storage.md) — Records video streams to a local file or storage based on a specified quality selector. ([source](https://github.com/android/camera-samples/blob/main/CameraXVideo))

### Development Tools & Productivity

- [Media Session Recording Controls](https://awesome-repositories.com/f/development-tools-productivity/macro-recorders/session-recorders/media-session-recording-controls.md) — Controls the video recording process by starting, pausing, and stopping the capture session. ([source](https://github.com/android/camera-samples/blob/main/CameraXVideo))
