Skip to content

Commit 0c68cbb

Browse files
committed
add comments
1 parent a8c4f1c commit 0c68cbb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

opencv.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
#include "opencv.hpp"
2-
#include "tone_mapping.hpp"
32

43
#include <stdbool.h>
5-
#include <cstdio>
6-
#include <memory>
74
#include <opencv2/highgui.hpp>
85
#include <opencv2/imgproc.hpp>
96
#include <jpeglib.h>
107
#include <png.h>
118
#include <setjmp.h>
129
#include <iostream>
13-
#include <lcms2.h>
1410

1511
// Interpolation constants
1612
const int CV_INTER_AREA = cv::INTER_AREA;

tone_mapping.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ cv::Mat* apply_hdr_to_sdr_tone_mapping(
2323
}
2424

2525
// Load ICC profile
26+
// NOTE: it may not be reliable to use just the icc profile for detecting HDR. some formats contain
27+
// flags and not profiles, but going to go with this for a first pass
2628
cmsHPROFILE src_profile = cmsOpenProfileFromMem(icc_data, icc_len);
2729
if (!src_profile) {
2830
return nullptr;
@@ -65,6 +67,8 @@ cv::Mat* apply_hdr_to_sdr_tone_mapping(
6567
}
6668

6769
// Apply Reinhard tone mapping
70+
// Tried to use OpenCV's built in tone mapping, but ran into issues with
71+
// dimming blown out/deep fried images. Using this as a first pass
6872
std::unique_ptr<cv::Mat> dst_bgr = std::make_unique<cv::Mat>(src_for_transform->rows, src_for_transform->cols, CV_8UC3);
6973

7074
// Apply luminance-based tone mapping to preserve color relationships

0 commit comments

Comments
 (0)