Cpp-Processing
Public Member Functions | Public Attributes | List of all members
celantur::ExifMetadata Struct Reference

Structure to manage EXIF metadata for images. This structure encapsulates EXIF data and provides methods to manipulate and retrieve information from it. It is used in conjunction with JPEG encoding and decoding functions to preserve image metadata. More...

#include <ImageEncoding.h>

Public Member Functions

 ExifMetadata (ExifData *data)
 Constructor that takes ownership of an ExifData pointer. More...
 
 ~ExifMetadata ()
 
 ExifMetadata (const ExifMetadata &)=delete
 
ExifMetadataoperator= (const ExifMetadata &)=delete
 
 ExifMetadata (ExifMetadata &&other) noexcept
 Move constructor. More...
 
ExifMetadataoperator= (ExifMetadata &&other) noexcept
 Move assignment operator. More...
 
void print_exif_entry (ExifEntry *entry, std::ostream &oss) const
 Print the EXIF metadata to the provided output stream. This function outputs the EXIF metadata in a human-readable format, useful for debugging and. More...
 
void print_exif_content (ExifContent *content, std::ostream &oss) const
 Print the contents of an ExifContent structure to the provided output stream. This function iterates through all entries in the ExifContent and prints their details. More...
 
int get_orientation () const
 Retrieve the orientation value from the EXIF metadata. This function extracts the orientation tag from the EXIF data, which indicates how the image should be rotated for correct display. More...
 

Public Attributes

ExifData * metadata {nullptr}
 Pointer to the underlying ExifData structure. This pointer is managed by the ExifMetadata instance and should not be accessed directly. More...
 

Detailed Description

Structure to manage EXIF metadata for images. This structure encapsulates EXIF data and provides methods to manipulate and retrieve information from it. It is used in conjunction with JPEG encoding and decoding functions to preserve image metadata.

Remarks
Note that ExifMetadata does not have a copy constructor. This is because ExifData is a C struct and never heard of memory management and RAII. When calling this function, use move semantics, e.g.
std::vector<unsigned char> encoded_image = celantur::jpeg_encode(image, 95, std::move(metadata));
std::vector< unsigned char > jpeg_encode(cv::Mat image, int jpeg_quality=95, std::optional< ExifMetadata > exif_metadata=std::nullopt)
Encode an image to JPEG format with optional EXIF metadata. This function compresses the input image ...
Definition: ImageEncoding.cpp:27
ExifData * metadata
Pointer to the underlying ExifData structure. This pointer is managed by the ExifMetadata instance an...
Definition: ImageEncoding.h:77
The destruction of the metadata is taken care in the jpeg_encode.

Constructor & Destructor Documentation

◆ ExifMetadata() [1/3]

celantur::ExifMetadata::ExifMetadata ( ExifData *  data)

Constructor that takes ownership of an ExifData pointer.

Parameters
dataPointer to ExifData from libexif. The ExifMetadata instance takes ownership and will free it upon destruction.

◆ ~ExifMetadata()

celantur::ExifMetadata::~ExifMetadata ( )

◆ ExifMetadata() [2/3]

celantur::ExifMetadata::ExifMetadata ( const ExifMetadata )
delete

◆ ExifMetadata() [3/3]

celantur::ExifMetadata::ExifMetadata ( ExifMetadata &&  other)
noexcept

Move constructor.

Member Function Documentation

◆ get_orientation()

int celantur::ExifMetadata::get_orientation ( ) const

Retrieve the orientation value from the EXIF metadata. This function extracts the orientation tag from the EXIF data, which indicates how the image should be rotated for correct display.

Returns
An integer representing the orientation value. Common values are 1 (normal), 3 (180 degrees), 6 (90 degrees clockwise), and 8 (90 degrees counter-clockwise).

◆ operator=() [1/2]

ExifMetadata& celantur::ExifMetadata::operator= ( const ExifMetadata )
delete

◆ operator=() [2/2]

ExifMetadata & celantur::ExifMetadata::operator= ( ExifMetadata &&  other)
noexcept

Move assignment operator.

◆ print_exif_content()

void celantur::ExifMetadata::print_exif_content ( ExifContent *  content,
std::ostream &  oss 
) const

Print the contents of an ExifContent structure to the provided output stream. This function iterates through all entries in the ExifContent and prints their details.

Parameters
contentPointer to the ExifContent structure to be printed.
ossOutput stream where the EXIF content will be printed.

◆ print_exif_entry()

void celantur::ExifMetadata::print_exif_entry ( ExifEntry *  entry,
std::ostream &  oss 
) const

Print the EXIF metadata to the provided output stream. This function outputs the EXIF metadata in a human-readable format, useful for debugging and.

Member Data Documentation

◆ metadata

ExifData* celantur::ExifMetadata::metadata {nullptr}

Pointer to the underlying ExifData structure. This pointer is managed by the ExifMetadata instance and should not be accessed directly.

Returns
Pointer to ExifData.