-
Notifications
You must be signed in to change notification settings - Fork 0
/
hdr.h
95 lines (84 loc) · 2.91 KB
/
hdr.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*****************************************************************//**
* \file hdr.h
* \brief functions for HDR
*
* \authors Dario Loi, Flavio Gezzi
* \date December 2022
*********************************************************************/
#pragma once
#include "vendor/CImg.h"
using namespace cimg_library;
/**
* @brief Map LDR images to HDR
*
* Implements the Exposure Fusion algorithm described in Mertens et al. combines
* the information of multiple Low Definition Range (LDR) images to reconstruct
* a High Definition image (HDR).
*
* @see https://web.stanford.edu/class/cs231m/project-1/exposure-fusion.pdf
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @return CImg<T> a CImg<T> object containing the HDR image
*/
template<typename T>
CImg<T> LDR_to_HDR(CImg<T> const& LDR_images);
/**
* @brief Compute the weights for each LDR image
*
* Computes the normalized weight matrix for a stack of LDR images.
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @return CImg<T> a CImg<T> object containing the weights for each LDR image
*/
template<typename T>
CImg<T> compute_W(CImg<T> const& LDR_images);
/**
* @brief Compute the Laplacian pyramid of the LDR images
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @return CImg<T> a CImg<T> object containing the Laplacian pyramid of the LDR images
*/
template<typename T>
CImg<T> compute_contrast(CImg<T> const& LDR_images);
/**
* @brief Compute the saturation of the LDR images
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @return CImg<T> a CImg<T> object containing the saturation of the LDR images
*/
template<typename T>
CImg<T> compute_saturation(CImg<T> const& LDR_images);
/**
* @brief Compute the exposure of the LDR images
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @return CImg<T> a CImg<T> object containing the exposure of the LDR images
*/
template<typename T>
CImg<T> compute_wexp(CImg<T> const& LDR_images);
/**
* @brief Fuse the LDR images
*
*
*
* @tparam T the integral type of the pixel
* @param LDR_images a CImg<T> object containing the LDR images
* @param weights a CImg<T> object containing the weights for each LDR image
* @return CImg<T>
*/
template<typename T>
CImg<T> fuse_LDR(CImg<T> const& LDR_images, CImg<T> const& weights);
/**
* @brief Reconstruction of the HDR image from the Laplacian pyramid
*
* @tparam T the integral type of the pixel
* @param fused_laplacian a CImg<T> object containing the Laplacian pyramid of the fused LDR images
* @return CImg<T> a CImg<T> object containing the final HDR image
*/
template<typename T>
CImg<T> reconstruct_pyramid(CImg<T> const& fused_laplacian);