From 17fbf4355747b1ceb9caca120aec9830a44621cf Mon Sep 17 00:00:00 2001 From: JinweiClarkChao Date: Mon, 24 Aug 2015 10:15:00 +0800 Subject: init --- DCP/recover.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 DCP/recover.cpp (limited to 'DCP/recover.cpp') 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 @@ +#include "dcp_core.h" + +void Recover(IplImage *Result, IplImage *InputImage, double A[]) +{ + double t0 = 0.1; + double t, tmp_res; + + int i, j, k; + int e = 0, number = 0; + double a = 0; + + for (i = 1; i <= height; i++) + { + for (j = 1; j <= width; j++) + { + t = real_trans[e++]; + t /= 255.0; + for (k = 0; k < 3; k++) + { + a = *(uchar *)(InputImage->imageData + (i - 1) * widthstep + (j - 1) * nch + k); + a /= 255; + + tmp_res = ((a - A[k]) / MaxTwo(t, t0)) + A[k]; + + real_recover[number++] = tmp_res; + + if (tmp_res > 1) + tmp_res = 1; + else if (tmp_res < 0) + tmp_res = 0; + + *(uchar *)(Result->imageData + (i - 1) * widthstep + (j - 1) * nch + k) = tmp_res * 255.0; + } + } + } +} \ No newline at end of file -- cgit v1.2.3