summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-10-19 16:01:23 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-23 16:05:50 +0300
commitcc65629b68d49d5f2a4d61537584c56ba510a335 (patch)
tree960d2d08884bae3b9793dbc264cda31b6acd012f /include
parent042649f044ae8cd2f9d970c4be180a2c2191d74e (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/camera.h2
-rw-r--r--include/libcamera/meson.build1
-rw-r--r--include/libcamera/orientation.h30
3 files changed, 33 insertions, 0 deletions
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 <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();
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 <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 */