[libcamera-devel] [RFC 2/4] libcamera: camera: Introduce CameraConfiguration::orientation

Jacopo Mondi jacopo.mondi at ideasonboard.com
Wed Jun 21 09:43:32 CEST 2023


Hi Umang

On Wed, Jun 21, 2023 at 11:16:11AM +0530, Umang Jain wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On 6/20/23 7:59 PM, Jacopo Mondi via libcamera-devel wrote:
> > Introduce CameraConfiguration::Orientation in the CameraConfiguration
> > class.
> >
> > The Orienation enumeration defines all possible 2D transformations
> > that can be applied to an image. The enumeration values follows the
> > ones defined by the EXIF specification, Tag 247 'orientation'.
>
> Also mention the EXIF spec version number maybe? I see it's EXIF Version
> 2.32
>
> Also it's not Tag 247, its Tag 274

Good catch thanks

>>

[snip]
removed images not to be moderated again

> >
> > diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
> > index 5bb065847e04..608774ce7768 100644
> > --- a/include/libcamera/camera.h
> > +++ b/include/libcamera/camera.h
> > @@ -38,6 +38,17 @@ public:
> >   		Invalid,
> >   	};
> > +	enum Orientation {
> > +		rotate0,
> > +		flipRotate0,
> > +		rotate180,
> > +		flipRotate180,
> > +		flipRotate270,
> > +		rotate90,
> > +		flipRotate90,
> > +		rotate270,
> > +	};
> > +
> >   	using iterator = std::vector<StreamConfiguration>::iterator;
> >   	using const_iterator = std::vector<StreamConfiguration>::const_iterator;
> > @@ -66,6 +77,7 @@ public:
> >   	std::size_t size() const;
> >   	Transform transform;
> > +	Orientation orientation;
> >   protected:
> >   	CameraConfiguration();
> > diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> > index 3e252f3b8f8d..5ca05719ebfc 100644
> > --- a/src/libcamera/camera.cpp
> > +++ b/src/libcamera/camera.cpp
> > @@ -145,6 +145,43 @@ LOG_DECLARE_CATEGORY(Camera)
> >    * The configuration is invalid and can't be adjusted automatically
> >    */
> > +/**
> > + * \enum CameraConfiguration::Orientation
> > + * \brief The image orientation
> > + *
> > + * The Orientation enumeration defines the possible transformation of the images
> > + * produced by the camera pipeline. Its fields definition follows the ones
> > + * provide by the EXIF Specification, Tag 247 "Orientation".
>
> Ditto.
>
> Other than that, looks good to me.

Thanks

> > + *
> > + * The naming of the enumeration values reports the rotation in clockwise
> > + * direction and any horizontal mirroring applied to the images.
> > + *
> > + * \var CameraConfiguration::rotate0
> > + * \image html rotation/rotate-0.png
> > + * \image latex rotation/rotate-0.eps
> > + * \var CameraConfiguration::flipRotate0
> > + * \image html rotation/flip-rotate-0.png
> > + * \image latex rotation/flip-rotate-0.eps
> > + * \var CameraConfiguration::rotate180
> > + * \image html rotation/rotate-180.png
> > + * \image latex rotation/rotate-180.eps
> > + * \var CameraConfiguration::flipRotate180
> > + * \image html rotation/flip-rotate-180.png
> > + * \image latex rotation/flip-rotate-180.eps
> > + * \var CameraConfiguration::flipRotate270
> > + * \image html rotation/flip-rotate-270.png
> > + * \image latex rotation/flip-rotate-270.eps
> > + * \var CameraConfiguration::rotate90
> > + * \image html rotation/rotate-90.png
> > + * \image latex rotation/rotate-90.eps
> > + * \var CameraConfiguration::flipRotate90
> > + * \image html rotation/flip-rotate-90.png
> > + * \image latex rotation/flip-rotate-90.eps
> > + * \var CameraConfiguration::rotate270
> > + * \image html rotation/rotate-270.png
> > + * \image latex rotation/rotate-270.eps
> > + */
> > +
> >   /**
> >    * \typedef CameraConfiguration::iterator
> >    * \brief Iterator for the stream configurations in the camera configuration
> > @@ -160,7 +197,7 @@ LOG_DECLARE_CATEGORY(Camera)
> >    * \brief Create an empty camera configuration
> >    */
> >   CameraConfiguration::CameraConfiguration()
> > -	: transform(Transform::Identity), config_({})
> > +	: transform(Transform::Identity), orientation(rotate0), config_({})
> >   {
> >   }
> > @@ -404,6 +441,18 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF
> >    * may adjust this field at its discretion if the selection is not supported.
> >    */
> > +/**
> > + * \var CameraConfiguration::orientation
> > + * \brief The desired orientation of the video streams produced by the camera
> > + *
> > + * The orientation field is a user-specified 2D plane transform that specifies
> > + * how the application wants the camera images to be rotated.
> > + *
> > + * If the application requested orientation cannot be obtained the validate()
> > + * function will Adjust this field to the actual orientation of the images
> > + * as produced by the camera pipeline.
> > + */
> > +
> >   /**
> >    * \var CameraConfiguration::config_
> >    * \brief The vector of stream configurations
>


More information about the libcamera-devel mailing list