DCP暗通道python
时间: 2023-10-15 22:28:00 浏览: 204
DCP暗通道python实现的代码可以参考以下示例:
```python
import cv2
import numpy as np
def get_min_channel(img):
return np.min(img, axis=2)
def guided_filter(I, p, win_size, eps):
mean_I = cv2.blur(I, (win_size, win_size))
mean_p = cv2.blur(p, (win_size, win_size))
corr_I = cv2.blur(I*I, (win_size, win_size))
corr_Ip = cv2.blur(I*p, (win_size, win_size))
var_I = corr_I - mean_I * mean_I
cov_Ip = corr_Ip - mean_I * mean_p
a = cov_Ip / (var_I + eps)
b = mean_p - a * mean_I
mean_a = cv2.blur(a, (win_size, win_size))
mean_b = cv2.blur(b, (win_size, win_size))
q = mean_a * I + mean_b
return q
def get_A(img_haze, dark_channel, bins_l):
hist, bins = np.histogram(dark_channel, bins=bins_l)
d = np.cumsum(hist) / float(dark_channel.size)
threshold = 0
for i in range(bins_l-1, 0, -1):
if d[i <= 0.999:
threshold = i
break
A = img_haze[dark_channel >= bins<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [暗通道去雾 python实现](https://blog.csdn.net/qtzbxjg/article/details/127144893)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文