Image Capture On Embedded Linux Systems

Similar documents
CMOS MT9D112 Camera Module 1/4-Inch 3-Megapixel Module Datasheet

User's Guide Baumer MX Board Level Cameras (Gigabit Ethernet) Document Version: v1.8 Release: Document Number:

CMVision and Color Segmentation. CSE398/498 Robocup 19 Jan 05

Light. intensity wavelength. Light is electromagnetic waves Laser is light that contains only a narrow spectrum of frequencies

Specifications and Interfaces

NanEye GS NanEye GS Stereo. Camera System

SCD-0017 Firegrab Documentation

VGA CMOS Image Sensor BF3905CS

CMOS MT9D111Camera Module 1/3.2-Inch 2-Megapixel Module Datasheet

A High Definition Motion JPEG Encoder Based on Epuma Platform

Data Sheet SMX-160 Series USB2.0 Cameras

Developing Image Processing Platforms ADAM TAYLOR ADIUVO ENGINEERING

Putting It All Together: Computer Architecture and the Digital Camera

Announcements. Electromagnetic Spectrum. The appearance of colors. Homework 4 is due Tue, Dec 6, 11:59 PM Reading:

AN5020 Application note

Introduction to Computer Vision CSE 152 Lecture 18

Color images C1 C2 C3

Brian Holden Kandou Bus, S.A. IEEE GE Study Group July 16, 2013 Geneva, Switzerland

SOME PHYSICAL LAYER ISSUES. Lecture Notes 2A

DESIGN, IMPLEMENTATION AND OPTIMISATION OF 4X4 MIMO-OFDM TRANSMITTER FOR

Part Number SuperPix TM image sensor is one of SuperPix TM 2 Mega Digital image sensor series products. These series sensors have the same maximum ima

REVOLUTIONIZING THE COMPUTING LANDSCAPE AND BEYOND.

A 3 Mpixel ROIC with 10 m Pixel Pitch and 120 Hz Frame Rate Digital Output

Spacecraft to Science Instrument Data Interface Control Document. Dwg. No

Color image processing

Software ISP Application Note

Advances in Antenna Measurement Instrumentation and Systems

Functional Verification of CSI-2 Rx-PHY using AMS Co-simulations

Bettina Selig. Centre for Image Analysis. Swedish University of Agricultural Sciences Uppsala University

CMOS OV7725 Camera Module 1/4-Inch 0.3-Megapixel Module Datasheet

EECE494: Computer Bus and SoC Interfacing. Serial Communication: RS-232. Dr. Charles Kim Electrical and Computer Engineering Howard University

Volume III July, 2009

MIPI Testing Challenges &Test Strategies using Best-in-Class Tools

Doc: page 1 of 6

Multimedia Systems Color Space Mahdi Amiri March 2012 Sharif University of Technology

Introduction & Colour

Computer and Machine Vision

BTS2048-BS. Product tags: VIS, Spectral Data, Industrial Applications, Laser.

SV2C 28 Gbps, 8 Lane SerDes Tester

Basler ace. USER S MANUAL FOR GigE CAMERAS

Various Calibration Functions for Webcams and AIBO under Linux

ICM532A CIF CMOS image sensor with USB output. Data Sheet

Imaging Process (review)

Data Acquisition System for the Angra Project

UXGA CMOS Image Sensor

Lecture #2 Solving the Interconnect Problems in VLSI

AUTOMATIC INSPECTION SYSTEM FOR CMOS CAMERA DEFECT. Byoung-Wook Choi*, Kuk Won Ko**, Kyoung-Chul Koh***, Bok Shin Ahn****

Lecture Color Image Processing. by Shahid Farid

Mahdi Amiri. March Sharif University of Technology

APIX Video Interface configuration

Digital Image Processing Lec 02 - Image Formation - Color Space

High Performance Imaging Using Large Camera Arrays

MCU with 315/433/868/915 MHz ISM Band Transmitter Module

CANopen Programmer s Manual Part Number Version 1.0 October All rights reserved

Designing with STM32F3x

BTS2048-UV. Product tags: UV, Spectral Data, LED Binning, Industrial Applications, LED.

6.098/6.882 Computational Photography 1. Problem Set 1. Assigned: Feb 9, 2006 Due: Feb 23, 2006

Systems. Roland Kammerer. 29. October Institute of Computer Engineering Vienna University of Technology. Communication in Distributed Embedded

Sunderland, NE England

TRUESENSE SPARSE COLOR FILTER PATTERN OVERVIEW SEPTEMBER 30, 2013 APPLICATION NOTE REVISION 1.0

VGA CMOS Image Sensor

RECOMMENDATION ITU-R BT.1362 * Interfaces for digital component video signals in 525- and 625-line progressive scan television systems

An FPGA Case Study: Narrowband COFDM Video Transceiver for Drones, UAV, and UGV. Produced by EE Times

Sales Document Description of three SR2000 based solutions offered by GomSpace

MULTIMEDIA SYSTEMS

SOFTWARE IMPLEMENTATION OF THE

Basic idea: divide spectrum into several 528 MHz bands.

The Architecture of the BTeV Pixel Readout Chip

Color Science. What light is. Measuring light. CS 4620 Lecture 15. Salient property is the spectral power distribution (SPD)

Basic Communications Theory Chapter 2

A simulation tool for evaluating digital camera image quality

SIMPLY PRECISE PRELIMINARY. Preliminary product overview - LAK encoder. LAK 1 Absolute linear encoder with signal control

Capturing Light in man and machine

Institute of Computer Technology

brief history of photography foveon X3 imager technology description

CDR in Mercury Devices

CS6640 Computational Photography. 6. Color science for digital photography Steve Marschner

Journal of Engineering Science and Technology Review 9 (5) (2016) Research Article. L. Pyrgas, A. Kalantzopoulos* and E. Zigouris.

Image Processing for Mechatronics Engineering For senior undergraduate students Academic Year 2017/2018, Winter Semester

Color. Used heavily in human vision. Color is a pixel property, making some recognition problems easy

CMOS Today & Tomorrow

Improvements of Demosaicking and Compression for Single Sensor Digital Cameras

UT90nHBD Hardened-by-Design (HBD) Standard Cell Data Sheet February

VGA CMOS Image Sensor BF3005CS

Correlator electronics. Alejandro Saez

UG0640 User Guide Bayer Interpolation

Lecture 2 Digital Image Fundamentals. Lin ZHANG, PhD School of Software Engineering Tongji University Fall 2016

Image Demosaicing. Chapter Introduction. Ruiwen Zhen and Robert L. Stevenson

Video Enhancement Algorithms on System on Chip

Image sensor combining the best of different worlds

SV3C CPTX MIPI C-PHY Generator. Data Sheet

Document Processing for Automatic Color form Dropout

Pixel-to-Byte Converter IP User Guide

Reconfigurable Video Image Processing

Lecture Notes 11 Introduction to Color Imaging

Grundlagen der Rechnernetze. Introduction

It should also be noted that with modern cameras users can choose for either

4.5.1 Mirroring Gain/Offset Registers GPIO CMV Snapshot Control... 14

Color Digital Imaging: Cameras, Scanners and Monitors

Capturing Light in man and machine

Transcription:

Image Capture On Embedded Linux Systems Jacopo Mondi FOSDEM 2018 Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (1/ 63)

Who am I Hello, I m Jacopo jacopo@jmondi.org irc: jmondi freenode.net Linux kernel and embedded software engineer Renesas Linux kernel team Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (1/ 63)

Motivations Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (2/ 63)

Image Capture On Embedded Linux Systems Light, color, pixels Image sensor Anatomy Integration Image Data transmission Video4Linux2 Basic architecture Memory management Image streaming Media controller APIs Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (3/ 63)

Light, colors, pixels Color is not an absolute value Neural response to physical properties of electromagnetic radiations Visible light has a well defined interval (390 nm to 700 nm) Not all species and not all humans perceive colors in the same way Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (4/ 63)

Light, colors, pixels The human eye is more sensitive to three frequencies short: blue color medium: green color long: red color Mathematical correlation between photo-optic properties and perceived color Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (5/ 63)

Light, colors, pixels Spectral power distribution We can describe a radiant emission of visible light as the intensity of a photo-optic property in function of the frequency of its component Figure: Spectral power distribution of standard illuminants. From: commons.wikimedia.org Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (6/ 63)

Light, colors, pixels The (very simple) LMS color space Samples of neural stimulus received by the human eye Samples on well-known wavelength The Long Medium Short color space Figure: Long-Medium-Short wave length sampling Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (7/ 63)

Light, colors, pixels LMS Colorspace LMS is theoretical tool too simple scheme to represent real use cases CIE 1931 defined colorspaces: RGB color space: Red Green Blue primary colors XYZ color space: luma component Y and associated chrominances x and z Notable color spaces: srgb, Adobe RBG, CYMK... Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (8/ 63)

Light, colors, pixels Colorspaces and color encodings Figure: From: commons.wikimedia.org Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (9/ 63)

Light, colors, pixels Color encoding schemes We have a mathematical model to represent values of a color with a tuple As we live in a digital world, we can now use those values to transmit the most basic information an image is composed of: a pixel Question: if we have to describe a single pixel with at least 3 digital values, how big would an image composed b bee by 1280x800 pixels? Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (10/ 63)

Light, colors, pixels Color encoding schemes We have a mathematical model to represent with a tuple of values a color As we live in a digital world, we can now use those values to transmit the most basic information an image is composed of: a pixel Answer: 24,5Mbit with a very limited color resolution (0-255) That s bad Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (11/ 63)

Light, colors, pixels It is highly unpractical to sense all 3 color components for each pixel of a sensor s pixel matrix Image resolution vs sensor size ratio Required bandwidth for digital information transmission Production costs and dimension not justified by resulting performances for most use cases Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (12/ 63)

Light, colors, pixels Bayer filter A Bayer filter is an arrangement of light filters on top of a CMOS sensor photo-receptors Each pixel transports a single color information Figure: From: http://www.cambridgeincolour.com Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (13/ 63)

Light, colors, pixels Bayer filter The full pixel color is re-constructed by demosaic and interpolation with neighbor pixels Reduces the required transmission bandwidth and sensor size Figure: From: http://www.cambridgeincolour.com Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (14/ 63)

Integration diagram Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (15/ 63)

Image sensors Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (16/ 63)

Image sensors Grid of CMOS photo-detectors: Pixel Grid Array Bayer pattern: RGB color filter array Color filter disposition: RGGB - BGGR - GRBG - RGGB etc. Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (17/ 63)

Image sensors Image format control: Pixel encoding: RGB555, YUV422, YUV420 etc Image manupulation: Cropping, binning, zoom Advances features (ie. 3A), mirroring, flipping etc Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (18/ 63)

Image sensors data transmissoin interfaces Mainly two data bus categories: Parallel (BT.601 - BT.656) MIPI Serial camera interface (MIPI CSI-2) Parallel bus: Lower data rate, lower resolutions, more wires.. Easier integration, cheaper, easy debug Usually found in industrial/automation contexts, hobbyist projects, older system in general MIPI Serial bus: Higher data rate, highly integrated, less wires Hard to integrate, hard to debug, more expensive Mobile devices, cameras, and new designs in general Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (19/ 63)

Image sensors data interface: BT.601 VSYNC - HSYNC/HREF vertical/horizontal synchronization signals PCLK: pixel clockout reference clock 8+ parallel data lanes Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (20/ 63)

Image sensors data interface: MIPI CSI-2 MIPI CSI-2 specifications not only define the physical layer, image formats and data transmission protocol. Physical layers: D-PHY, C-PHY Data transmission protocol: Media bus image formats: RGB or YUYV permutations Short packets for synchronization signals (line/frame start/end) Long packets for actual data with header for data description Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (21/ 63)

Image sensors data interface: MIPI CSI-2 Physical layers MIPI D-PHY Differential lines signals Up to 1Gbps per lane 1 clock signal and 1 to 4 data lanes MIPI C-PHY Differential data lanes with embedded clock (3 pin) Up to three trios Up to 5.7Gbps per trio Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (22/ 63)

Image sensors data interface: MIPI CSI-2 Packet-oriented protocol Short packets for synchronization: Frame start/end - Line start/end Long packets for data A data stream is a sequence of pixel data enclosed in a <FS> <FE> sequence Each data packet is identified by a DT and a VC specified in its header Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (23/ 63)

Image sensors data interface: MIPI CSI-2 Different data stream can be multiplexed on the same physical bus Data type (DT) Data type identifier as defined by CSI-2 specs Different image formats interleaved in the same stream Virtual channel (VC) interleaving Channel identifier: [0-3 or 0-6] Multiple streams interleaved Each stream can be data type interleaved Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (24/ 63)

Image sensors data interface: MIPI CSI-2 Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (25/ 63)

Image sensors data interface: MIPI CSI-2 Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (26/ 63)

Video4Linux2: a basic use case Basic use case: single sensor connected to a video receiver Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (27/ 63)

Video4Linux2: basic workflow Preliminary operations Open the video device node Control the video device through V4L2 IOCTL: Query capabilities to make sure the device can stream Set image format on platform and sensor drivers Set image size on platform and sensor drivers Set stream parameters (frame rate) on platform and sensor drivers Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (28/ 63)

Video4Linux2: memory allocation Video memory requirements DMA capable memory (often implies contiguity if DMA engine do not support s/g operations) Accessible by CPU and devices (in case of IOMMU) Possibly shared between different subsystems to reduce userspace copies Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (29/ 63)

Video4Linux2: memory allocation Three memory allocation model Kernel uses pointers to userspace buffers mmap of kernel buffers in userspace land Buffer sharing through DMABUF Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (30/ 63)

Video4Linux2: memory allocation - mmap Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (31/ 63)

Video4Linux2: memory allocation - mmap Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (32/ 63)

Video4Linux2: memory allocation - mmap Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (33/ 63)

Video4Linux2: memory allocation - mmap Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (34/ 63)

Video4Linux2: memory allocation - dmabuf Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (35/ 63)

Video4Linux2: memory allocation - dmabuf Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (36/ 63)

Video4Linux2: memory allocation - dmabuf Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (37/ 63)

Video4Linux2: memory allocation - dmabuf Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (38/ 63)

Video4Linux2: memory allocation - dmabuf Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (39/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (40/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (41/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (42/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (43/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (44/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (45/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (46/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (47/ 63)

Video4Linux2: zero copy image streaming Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (48/ 63)

Video4Linux2: platform drivers drivers/media/platform/ Transfer image data from internal buffers to system memory Perform transformations on the received images before presenting them to userspace Implement user space API through video device abstraction (or through media controller...) Handle IRQs and program receiver interface DMA to actually capture images Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (49/ 63)

Video4Linux2: image sensor drivers drivers/media/i2c/ Control the image sensor through I2c transaction Respond to platform driver calls to set/get streaming parameters Start/stop sensor when platform driver requires data Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (50/ 63)

Video4Linux2: Device tree bindings Documentation/devicetree/bindings/ Bindings defines a driver/subsystem ABI How drivers expects to be instantiated Which and how supply parameters to a driver Documentation/devicetree/bindings/media/ Video devices: how do they connect to each other Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (51/ 63)

Video4Linux2: Device tree bindings Platform drivers - Image receivers.. /bindings/media/video-interfaces.txt device { #address-cells = <1>; #size-cells = <0>; port@0 { }; reg = <0>; endpoint { "endpoint properties"; remote-endpoint = <&phandle-0>; }; Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (52/ 63)

Video4Linux2: Device tree bindings Endpoint properties Parallel input bus vsync-active = <1> / <0>; hsync-active = <1> / <0>; data-active = <1> / <0>;... CSI-2 data-lanes = <1 2...> clock lanes = <0> link-frequencies = <210000000> Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (53/ 63)

Video4Linux2: platform drivers static int platform_probe(struct i2c_client *client) { priv = devm_kzalloc(sizeof(*priv)); devm_ioremap(resources); devm_request_irq(irq) pm_runtime_enable(); platform_parse_dt(dev->of_node); v4l2_async_notifier_register(priv->notifier); } return 0; Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (54/ 63)

Video4Linux2: the media controller The V4L2 video device APIs are not enough to represent the complexity in modern SoCs Dedicated IP blocks on the SoC for image transformation media-controller: graph of media entities with sink and source pads Each entity can be linked to another entity media-controller allows the creation of image manipulation pipelines Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (55/ 63)

Video4Linux2: the media controller Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (56/ 63)

Video4Linux2: the media controller Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (57/ 63)

Video4Linux2: the media controller Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (58/ 63)

Video4Linux2: the media controller Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (59/ 63)

Video4Linux2: the media controller Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (60/ 63)

Video4Linux2: the media controller The media controller drawbacks Pipeline creation and management all in userspace System boots in a non-usable way Video devices vs video sub-devices APIs Complexity some times not justified for simple use cases Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (61/ 63)

Thank you! Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (62/ 63)

Questions? Jacopo Mondi - FOSDEM 2018 Image Capture On Embedded Linux Systems (63/ 63)