From ec097d63ef9064cc495d9126b54dc772e83137d7 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Mon, 16 Dec 2024 16:40:43 +0100 Subject: libcamera: geometry: Add Rectangle::transformedBetween() Handling cropping and scaling within a complicated pipeline involves transformations of rectangles between different coordinate systems. For example the full input of the dewarper (0,0)/1920x1080 might correspond to the rectangle (0, 243)/2592x1458 in sensor coordinates (of a 2592x1944 sensor). Add a function that allows the transformation of a rectangle defined in one reference frame (dewarper) into the coordinates of a second reference frame (sensor). Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- include/libcamera/geometry.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h index 9ca5865a..e5f0a843 100644 --- a/include/libcamera/geometry.h +++ b/include/libcamera/geometry.h @@ -299,6 +299,9 @@ public: __nodiscard Rectangle scaledBy(const Size &numerator, const Size &denominator) const; __nodiscard Rectangle translatedBy(const Point &point) const; + + Rectangle transformedBetween(const Rectangle &source, + const Rectangle &target) const; }; bool operator==(const Rectangle &lhs, const Rectangle &rhs); -- cgit v1.2.1