aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinweiClarkChao <[email protected]>2015-08-25 16:03:05 +0800
committerJinweiClarkChao <[email protected]>2015-08-25 16:49:50 +0800
commit66efed8b335610f9eae59fd3f52eccaffd7a6e0b (patch)
treea65d3ad57aa75d072b5f543fd5ea5c0a18a5c1ab /DCP/transmission.cpp
parentf07885c1eb4c98dc52704517623b2e7df1ed616d (diff)
downloadDehaze-66efed8b335610f9eae59fd3f52eccaffd7a6e0b.tar.gz
fix
Diffstat (limited to 'DCP/transmission.cpp')
-rw-r--r--DCP/transmission.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/DCP/transmission.cpp b/DCP/transmission.cpp
index 48a8299..0079ef7 100644
--- a/DCP/transmission.cpp
+++ b/DCP/transmission.cpp
@@ -22,7 +22,7 @@ void CalcTransmission(IplImage *transmission, IplImage *input, double A[], int r
22 tmp = tmp / A[k] * 255.0; 22 tmp = tmp / A[k] * 255.0;
23 23
24 tmp = tmp > 255 ? 255 : tmp; 24 tmp = tmp > 255 ? 255 : tmp;
25 *(uchar *)(normalized_input->imageData + i * widthstep + j * nch + k) = tmp; 25 *(uchar *)(normalized_input->imageData + i * widthstep + j * nch + k) = cvRound(tmp);
26 } 26 }
27 } 27 }
28 } 28 }
@@ -35,11 +35,10 @@ void CalcTransmission(IplImage *transmission, IplImage *input, double A[], int r
35 double tran = *(uchar *)(transmission->imageData + i * gwidthstep + j); 35 double tran = *(uchar *)(transmission->imageData + i * gwidthstep + j);
36 36
37 tran = 1 - w * (tran / 255.0); 37 tran = 1 - w * (tran / 255.0);
38 tran *= 255.0;
39 tran = tran > 255 ? 255 : (tran < 0 ? 0 : tran);
38 40
39 tran = tran > 1 ? 1 : tran; 41 *(uchar *)(transmission->imageData + i * gwidthstep + j) = cvRound(tran);
40 tran = tran < 0 ? 0 : tran;
41
42 *(uchar *)(transmission->imageData + i * gwidthstep + j) = tran * 255;
43 } 42 }
44 } 43 }
45 cvReleaseImage(&normalized_input); 44 cvReleaseImage(&normalized_input);
Powered by cgit v1.2.3 (git 2.41.0)