iVS3D v2.0.0
Loading...
Searching...
No Matches
Resolution Class Reference

The Resolution class encapsulates an image resolution (width and height). It provides functionality for parsing from a string, converting from and to different Qt and OpenCV formats and for resizing images to the specified resolution. More...

#include <resolution.h>

Public Member Functions

 Resolution ()
 Default constructor initializing width and height to zero. This resolution is not valid, but can i.e. be initialized from a string!
 
 Resolution (uint width, uint height)
 Constructs a Resolution object with specified width and height.
 
 Resolution (const cv::Size &size)
 Constructs a Resolution object from an OpenCV Size object.
 
 Resolution (const QSize &size)
 Constructs a Resolution object from a QSize object.
 
 Resolution (const QPoint &size)
 Constructs a Resolution object from a QPoint object.
 
 Resolution (const cv::Mat &img)
 Constructs a Resolution object from an OpenCV Mat object.
 
bool isValid () const
 Checks whether the resolution is valid (i.e., width and height are greater than zero).
 
bool operator== (const Resolution &other) const
 Equality operator to compare two Resolution objects.
 
void resize (const cv::Mat &src, cv::Mat &dest) const
 Resizes an OpenCV Mat image to the resolution defined in this object.
 
void resize (cv::Mat &img) const
 Resizes an OpenCV Mat image in-place.
 
bool fromString (const QString &resolution)
 Parses resolution from a string format.
 

Detailed Description

The Resolution class encapsulates an image resolution (width and height). It provides functionality for parsing from a string, converting from and to different Qt and OpenCV formats and for resizing images to the specified resolution.

Author
Dominik Wüst
Date
March 2025

Constructor & Destructor Documentation

◆ Resolution() [1/5]

Resolution::Resolution ( uint  width,
uint  height 
)
inline

Constructs a Resolution object with specified width and height.

Parameters
widthThe width of the resolution.
heightThe height of the resolution.

◆ Resolution() [2/5]

Resolution::Resolution ( const cv::Size &  size)
inline

Constructs a Resolution object from an OpenCV Size object.

Parameters
sizeOpenCV Size containing width and height.

◆ Resolution() [3/5]

Resolution::Resolution ( const QSize &  size)
inline

Constructs a Resolution object from a QSize object.

Parameters
sizeQSize containing width and height.

◆ Resolution() [4/5]

Resolution::Resolution ( const QPoint &  size)
inline

Constructs a Resolution object from a QPoint object.

Parameters
sizeQPoint where x represents width and y represents height.

◆ Resolution() [5/5]

Resolution::Resolution ( const cv::Mat &  img)
inline

Constructs a Resolution object from an OpenCV Mat object.

Parameters
imgOpenCV Mat where width and height are extracted from its dimensions.

Member Function Documentation

◆ fromString()

bool Resolution::fromString ( const QString &  resolution)

Parses resolution from a string format.

Parameters
resolutionThe string containing the resolution.
Returns
True if parsing was successful, false otherwise.

◆ isValid()

bool Resolution::isValid ( ) const
inline

Checks whether the resolution is valid (i.e., width and height are greater than zero).

Returns
True if valid, false otherwise.

◆ operator==()

bool Resolution::operator== ( const Resolution other) const
inline

Equality operator to compare two Resolution objects.

Parameters
otherThe Resolution object to compare against.
Returns
True if both resolutions have the same width and height, false otherwise.

◆ resize() [1/2]

void Resolution::resize ( const cv::Mat &  src,
cv::Mat &  dest 
) const
inline

Resizes an OpenCV Mat image to the resolution defined in this object.

Parameters
srcInput image.
destOutput image (resized).

◆ resize() [2/2]

void Resolution::resize ( cv::Mat &  img) const
inline

Resizes an OpenCV Mat image in-place.

Parameters
imgImage to resize.

The documentation for this class was generated from the following files: