Ocean
ImageQuality.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_CV_IMAGE_QUALITY_H
9 #define META_OCEAN_CV_IMAGE_QUALITY_H
10 
11 #include "ocean/cv/CV.h"
12 
13 #include "ocean/base/Frame.h"
14 #include "ocean/base/Worker.h"
15 
16 namespace Ocean
17 {
18 
19 namespace CV
20 {
21 
22 /**
23  * This class implements functions to measure the quality of images.
24  * @ingroup oceancv
25  */
26 class OCEAN_CV_EXPORT ImageQuality
27 {
28  public:
29 
30  /**
31  * Determines the structural similarity (SSIM) of two images with identical frame type for images with pixel formats that have 8 bit per channel.
32  * @param imageX The first image to be used, must be valid
33  * @param imageY The second image to be used, e.g., a compressed/noisy version of image x, must be valid
34  * @param width The width of both images in pixel, with range [11, infinity)
35  * @param height The height of both images in pixel, with range [11, infinity)
36  * @param channels The number of data channels both images have, with range [1, infinity)
37  * @param imageXPaddingElements Optional number of padding elements at the end of each first image row, in elements, with range [0, infinity)
38  * @param imageYPaddingElements Optional number of padding elements at the end of each second image row, in elements, with range [0, infinity)
39  * @param meanSSIM The resulting ssim index, with range [0, 1]
40  * @param meanContrast The resulting mean contrast measure, with range [0, 1]
41  * @param worker Optional worker object to distribute the computation
42  * @see multiScaleStructuralSimilarity8BitPerChannel().
43  */
44  static bool structuralSimilarity8BitPerChannel(const uint8_t* const imageX, const uint8_t* const imageY, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int imageXPaddingElements, const unsigned int imageYPaddingElements, double& meanSSIM, double& meanContrast, Worker* worker = nullptr);
45 
46  /**
47  * Determines the multi-scale structural similarity (MSSSIM) of two images with identical frame type for images with pixel formats that have 8 bit per channel.
48  *
49  * Beware: For backwards-compatibility the implementation of this function does not fully match that in the paper "Multi-Scale Structural Similarity for Image Quality Assessment"
50  *
51  * @param imageX The first image to be used, must be valid
52  * @param imageY The second image to be used, must be valid
53  * @param width The width of both images in pixel, with range [11, infinity)
54  * @param height The height of both images in pixel, with range [11, infinity)
55  * @param channels The number of data channels both images have, with range [1, 4]
56  * @param imageXPaddingElements Optional number of padding elements at the end of each first image row, in elements, with range [0, infinity)
57  * @param imageYPaddingElements Optional number of padding elements at the end of each second image row, in elements, with range [0, infinity)
58  * @param msssim The resulting msssim index, with range [0, 1]
59  * @param worker Optional worker object to distribute the computation
60  * @see structuralSimilarity8BitPerChannel().
61  */
62  static bool multiScaleStructuralSimilarity8BitPerChannel(const uint8_t* const imageX, const uint8_t* const imageY, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int imageXPaddingElements, const unsigned int imageYPaddingElements, double& msssim, Worker* worker = nullptr);
63 };
64 
65 }
66 
67 }
68 
69 #endif // META_OCEAN_CV_IMAGE_QUALITY_H
This class implements functions to measure the quality of images.
Definition: ImageQuality.h:27
static bool multiScaleStructuralSimilarity8BitPerChannel(const uint8_t *const imageX, const uint8_t *const imageY, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int imageXPaddingElements, const unsigned int imageYPaddingElements, double &msssim, Worker *worker=nullptr)
Determines the multi-scale structural similarity (MSSSIM) of two images with identical frame type for...
static bool structuralSimilarity8BitPerChannel(const uint8_t *const imageX, const uint8_t *const imageY, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int imageXPaddingElements, const unsigned int imageYPaddingElements, double &meanSSIM, double &meanContrast, Worker *worker=nullptr)
Determines the structural similarity (SSIM) of two images with identical frame type for images with p...
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15