-
Notifications
You must be signed in to change notification settings - Fork 2
/
clahe.hpp
42 lines (35 loc) · 1.17 KB
/
clahe.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* file: clahe.hpp
* purpose: Declaration of a free function which takes images read in through
* OpenCV and performs a contrast-limited adaptive histogram
* equalization operation.
*/
#pragma once
#include <functional>
#include "utility.hpp"
/*
* Forward Declarations
*/
namespace cv
{
class Mat;
}
using LookupTable = std::array<uint8_t, 256>;
using GrayLevelMappingFunction = std::function<void(ImageHistogram const & histogram, LookupTable * outputTable)>;
/*
* Takes a grayscale image and runs a CLAHE algorithm on it.
*
* input- The matrix holding the input image.
* output- The matrix for the output image to be stored in.
* clipLimit- The limit for a single bin of the histogram.
*
* Returns an integer indicating whether the process was successful; 0
* indicates success and -1 indicates a failure.
*/
[[nodiscard]] int clahe(cv::Mat const & input,
cv::Mat & output,
double clipLimit = 40.0) noexcept;
[[nodiscard]] int clahe(cv::Mat const & input,
cv::Mat & output,
GrayLevelMappingFunction mapping,
double clipLimit = 40.0) noexcept;