Skip to content

Commit

Permalink
Merge pull request #553 from lipi17dpatnaik/patch-1
Browse files Browse the repository at this point in the history
Updating Improving-Illumination-in-Night-Time-Images blog code
  • Loading branch information
aditya-AI authored Mar 9, 2021
2 parents 9496155 + 6da0763 commit 75fd172
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Improving-Illumination-in-Night-Time-Images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

### Python

To run the code in Python, please use `python night_images.py`
To run the code in Python, please go into the `python` folder and use `python night_images.py`

### C++

To run the code in C++, please follow the steps given below:
To run the code in C++, please go into the `cpp` folder and follow the steps given below:

```
mkdir build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,4 @@ int main() {
cv::imshow("im", out_img);
cv::waitKey(0);
return 0;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ def guided_filter(I, p, r=15, eps=1e-3):
# ECCV10 eq.16
q = (boxfilter(a[:, :, R], r)*I[:, :, R] + boxfilter(a[:, :, G], r)*I[:, :, G] + boxfilter(a[:, :, B], r)*I[:, :, B] + boxfilter(b, r)) / base

return q
return q
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def reduce_init_t(init_t):
init_t = init_t.astype(np.float64)/255
return init_t

im = cv2.imread('dark_light.png')
im = cv2.imread('dark.png')
orig = im.copy()

tmin = 0.1 # minimum value for t to make J image
Expand All @@ -106,36 +106,3 @@ def reduce_init_t(init_t):
cv2.imshow('F_enhanced2', f_enhanced2)
cv2.waitKey(0)
cv2.destroyAllWindows()
# dehaze(I, tmin, w, alpha, omega, p, eps)
# m, n, _ = I.shape
# Idark, Ibright = get_illumination_channel(I, w)

# A = get_atmosphere(I, Ibright, p)
# print('atmosphere:{}'.format(A))

# init_t = get_initial_transmission(A, Ibright)
# # cv2.imshow('coindndf_orig', (init_t*255).astype(np.uint8))
# init_t2 = reduce_init_t(init_t)

# corrected_t = get_corrected_transmission(I, A, Idark, Ibright, init_t, alpha, omega, w)
# # cv2.imshow('corrected_t_orig', (corrected_t*255).astype(np.uint8))
# corrected_t2 = get_corrected_transmission(I, A, Idark, Ibright, init_t2, alpha, omega, w)
# # cv2.imshow('corrected_t', (corrected_t2*255).astype(np.uint8))
# # guided filter
# normI = (I - I.min()) / (I.max() - I.min()) # min-max normalize I
# refined_t = guided_filter(normI, corrected_t, w, eps)
# refined_t2 = guided_filter(normI, corrected_t2, w, eps)

# J_refined = get_final_image(I, A, refined_t, tmin)
# J_refined2 = get_final_image(I, A, refined_t2, tmin)
# enhanced = (J_refined*255).astype(np.uint8)
# f_enhanced = cv2.detailEnhance(enhanced, sigma_s=10, sigma_r=0.15)
# f_enhanced = cv2.edgePreservingFilter(f_enhanced, flags=1, sigma_s=64, sigma_r=0.2)
# enhanced2 = (J_refined2*255).astype(np.uint8)
# f_enhanced2 = cv2.detailEnhance(enhanced2, sigma_s=10, sigma_r=0.15)
# f_enhanced2 = cv2.edgePreservingFilter(f_enhanced2, flags=1, sigma_s=64, sigma_r=0.2)
# cv2.imshow('original', orig)
# cv2.imshow('F_enhanced', f_enhanced)
# cv2.imshow('F_enhanced2', f_enhanced2)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy
opencv-contrib-python

0 comments on commit 75fd172

Please sign in to comment.