libcamera: camera: Introduce Orientation

Introduce the Orientation enumeration which describes the possible 2D
transformations that can be applied to an image using two basic plane
transformations.

Add to the CameraConfiguration class a new member 'orientation' which is
used to specify the image orientation in the memory buffers delivered to
applications.

The enumeration values follow the ones defined by the EXIF specification at
revision 2.32, Tag 274 'orientation'.

The newly introduced field is meant to replace
CameraConfiguration::transform which is not removed yet not to break
compilation.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2023-10-19 16:01:23 +02:00 committed by Laurent Pinchart
parent 042649f044
commit cc65629b68
6 changed files with 149 additions and 1 deletions

View file

@ -21,6 +21,7 @@
#include <libcamera/controls.h>
#include <libcamera/geometry.h>
#include <libcamera/orientation.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
#include <libcamera/transform.h>
@ -94,6 +95,7 @@ public:
std::optional<SensorConfiguration> sensorConfig;
Transform transform;
Orientation orientation;
protected:
CameraConfiguration();

View file

@ -12,6 +12,7 @@ libcamera_public_headers = files([
'framebuffer_allocator.h',
'geometry.h',
'logging.h',
'orientation.h',
'pixel_format.h',
'request.h',
'stream.h',

View file

@ -0,0 +1,30 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2023, Ideas On Board Oy
*
* orientation.h - Image orientation
*/
#pragma once
#include <iostream>
namespace libcamera {
enum class Orientation {
/* EXIF tag 274 starts from '1' */
Rotate0 = 1,
Rotate0Mirror,
Rotate180,
Rotate180Mirror,
Rotate90Mirror,
Rotate270,
Rotate270Mirror,
Rotate90,
};
Orientation orientationFromRotation(int angle, bool *success = nullptr);
std::ostream &operator<<(std::ostream &out, const Orientation &orientation);
} /* namespace libcamera */