aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'DCP/recover.cpp')
-rw-r--r--DCP/recover.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/DCP/recover.cpp b/DCP/recover.cpp
index 5dbd75e..b4609d7 100644
--- a/DCP/recover.cpp
+++ b/DCP/recover.cpp
@@ -27,17 +27,14 @@ void CalcRecover(IplImage *result, IplImage *input, IplImage *transmission, doub
27 t /= 255.0; 27 t /= 255.0;
28 for (k = 0; k < 3; k++) 28 for (k = 0; k < 3; k++)
29 { 29 {
30 a = *(uchar *)(input->imageData + (i) * widthstep + (j) * nch + k); 30 a = *(uchar *)(input->imageData + i * widthstep + j * nch + k);
31 a /= 255.0; 31 a /= 255.0;
32 32
33 tmp_res = ((a - A[k]) / MAX(t, t0)) + A[k]; 33 tmp_res = ((a - A[k]) / MAX(t, t0)) + A[k];
34 tmp_res *= 255.0;
35 tmp_res = tmp_res > 255 ? 255 : (tmp_res < 0 ? 0 : tmp_res);
34 36
35 if (tmp_res > 1) 37 *(uchar *)(result->imageData + i * widthstep + j * nch + k) = cvRound(tmp_res);
36 tmp_res = 1;
37 else if (tmp_res < 0)
38 tmp_res = 0;
39
40 *(uchar *)(result->imageData + (i) * widthstep + (j) * nch + k) = tmp_res * 255.0;
41 } 38 }
42 } 39 }
43 } 40 }
Powered by cgit v1.2.3 (git 2.41.0)