diff options
Diffstat (limited to 'src/ipa/ipu3/meson.build')
0 files changed, 0 insertions, 0 deletions
![]() |
index : libcamera/vivid.git | |
libcamera pipeline handler for VIVID | git repository hosting on libcamera.org |
summaryrefslogtreecommitdiff |
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
# A simple libcamera capture example
#
# This is a python version of simple-cam from:
# https://git.libcamera.org/libcamera/simple-cam.git
#
# \todo Move to simple-cam repository when the Python API has stabilized more
import libcamera as libcam
import selectors
import sys
import time
TIMEOUT_SEC = 3
def handle_camera_event(cm):
# cm.get_ready_requests() returns the ready requests, which in our case
# should almost always return a single Request, but in some cases there
# could be multiple or none.
reqs = cm.get_ready_requests()
# Process the captured frames
for req in reqs:
process_request(req)
def process_request(request):
global camera
print()
print(f'Request completed: {request}')
# When a request has completed, it is populated with a metadata control
# list that allows an application to determine various properties of
# the completed request. This can include the timestamp of the Sensor
# capture, or its gain and exposure values, or properties from the IPA
# such as the state of the 3A algorithms.
#
# To examine each request, print all the metadata for inspection. A custom
# application can parse each of these items and process them according to
# its needs.
requestMetadata = request.metadata
for id, value in requestMetadata.items():
print(f'\t{id.name} = {value}')
# Each buffer has its own FrameMetadata to describe its state, or the
# usage of each buffer. While in our simple capture we only provide one
# buffer per request, a request can have a buffer for each stream that
# is established when configuring the camera.
#
# This allows a viewfinder and a still image to be processed at the
# same time, or to allow obtaining the RAW capture buffer from the
# sensor along with the image as processed by the ISP.
buffers = request.buffers
for _, buffer in buffers.items():
metadata = buffer.metadata
# Print some information about the buffer which has completed.
print(f' seq: {metadata.sequence:06} timestamp: {metadata.timestamp} bytesused: ' +
'/'.join([str(p.bytes_used) for p in metadata.planes]))
# Image data can be accessed here, but the FrameBuffer
# must be mapped by the application