aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'DCP/recover.cpp')
-rw-r--r--DCP/recover.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/DCP/recover.cpp b/DCP/recover.cpp
new file mode 100644
index 0000000..a99b0f2
--- /dev/null
+++ b/DCP/recover.cpp
@@ -0,0 +1,36 @@
1#include "dcp_core.h"
2
3void Recover(IplImage *Result, IplImage *InputImage, double A[])
4{
5 double t0 = 0.1;
6 double t, tmp_res;
7
8 int i, j, k;
9 int e = 0, number = 0;
10 double a = 0;
11
12 for (i = 1; i <= height; i++)
13 {
14 for (j = 1; j <= width; j++)
15 {
16 t = real_trans[e++];
17 t /= 255.0;
18 for (k = 0; k < 3; k++)
19 {
20 a = *(uchar *)(InputImage->imageData + (i - 1) * widthstep + (j - 1) * nch + k);
21 a /= 255;
22
23 tmp_res = ((a - A[k]) / MaxTwo(t, t0)) + A[k];
24
25 real_recover[number++] = tmp_res;
26
27 if (tmp_res > 1)
28 tmp_res = 1;
29 else if (tmp_res < 0)
30 tmp_res = 0;
31
32 *(uchar *)(Result->imageData + (i - 1) * widthstep + (j - 1) * nch + k) = tmp_res * 255.0;
33 }
34 }
35 }
36} \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)