From cc65629b68d49d5f2a4d61537584c56ba510a335 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Thu, 19 Oct 2023 16:01:23 +0200 Subject: 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 Reviewed-by: David Plowman Signed-off-by: Laurent Pinchart --- include/libcamera/camera.h | 2 ++ include/libcamera/meson.build | 1 + include/libcamera/orientation.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 include/libcamera/orientation.h (limited to 'include') diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index decf4ec0..a4536c72 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -94,6 +95,7 @@ public: std::optional sensorConfig; Transform transform; + Orientation orientation; protected: CameraConfiguration(); diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 408b7acf..a24c50d6 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -12,6 +12,7 @@ libcamera_public_headers = files([ 'framebuffer_allocator.h', 'geometry.h', 'logging.h', + 'orientation.h', 'pixel_format.h', 'request.h', 'stream.h', diff --git a/include/libcamera/orientation.h b/include/libcamera/orientation.h new file mode 100644 index 00000000..9a2c2fb2 --- /dev/null +++ b/include/libcamera/orientation.h @@ -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 + +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 */ -- cgit v1.2.1