#系统观测误差,根据模型进行调节
R = 0.05
#输入为前一个时刻的预测值、前一个时刻的预测误差,当前时刻的观测值
#输出为当前时刻的预测值、当前时刻的预测误差
def kalman_filter(last_predict_point, last_P, input_point):
#通过当前观测值与前一时刻预测值的距离,计算系统过程噪声
distance = dis(input_point - last_predict_point)
alpha = clamp(distance/max_distance, 0.0, 1.0)
#系统过程噪声误差
Q = alpha + eps
#系统预测误差
P = last_P + Q
#卡尔曼增益
K = P / (P + R)
#当前时刻的预测值
cnt_predict_point = last_predict_point + K * (input_point - last_predict_point)
#更新当前时刻预测误差
cnt_P = (1 - K)* P
return cnt_predict_point, cnt_P
R>95&&G>40&&B>20&&R>G&&R>B&&max(R,G,B)−min(R,G,B)>15&&abs(R−G)>15
#表面模糊Surface Blur
#references:https://blog.csdn.net/shinian1987/article/details/78345408
def sur_blur ( I_in, thre=20, half_size=10):
I_out = I_in * 1.0
row, col = I_in.shape
w_size = half_size * 2 + 1
for ii in range (half_size, row-1-half_size):
for jj in range (half_size, col-1-half_size):
aa = I_in [ii-half_size:ii+half_size+1, jj-half_size : jj+half_size+1]
p0 = I_in [ii, jj]
mask_1 = numpy.matlib.repmat(p0, w_size, w_size)
mask_2 = 1-abs(aa-mask_1)/(2.5*thre);
mask_3 = mask_2 * (mask_2 > 0)
t1 = aa * mask_3
I_out[ii, jj] = t1.sum()/mask_3.sum()
return I_out
#获取滤镜颜色
#输入为图像、查找表、图像中位置
#输出为对应位置的颜色值
def getBGR(img, table, i, j):
#获取图像颜色
b, g, r = img[i][j]
#计算标准颜色表中颜色的位置座标
x = int(g/4 + int(b/32) * 64)
y = int(r/4 + int((b%32) / 4) * 64)
#返回滤镜颜色表中对应的颜色
return table[x][y]
#简单使用代码
img = cv2.imread('input.png')
lut_map = cv2.imread('lut.png')
rows, cols = img.shape[:2]
dst = np.zeros((rows, cols, 3), dtype="uint8")
for i in range(rows):
for j in range(cols):
dst[i][j] = getBGR(img, lut_map, i, j)
交流群
欢迎加入公众号读者群一起和同行交流,目前有美颜、三维视觉、计算摄影、检测、分割、识别、医学影像、GAN、算法竞赛等微信群
个人微信(如果没有备注不拉群!)
请注明:
地区+学校/企业+研究方向+暱称
下载1:何恺明顶会分享
在「AI算法与图像处理」公众号后台回复:何恺明,即可下载。总共有6份PDF,涉及 ResNet、Mask RCNN等经典工作的总结分析
下载2:终身受益的编程指南:Google编程风格指南
在「AI算法与图像处理」公众号后台回复:c++,即可下载。历经十年考验,最权威的编程规范!
下载3 CVPR2021
在「AI算法与图像处理」公众号后台回复:
CVPR
,即可下载1467篇CVPR 2020论文 和 CVPR 2021 最新论文
本文分享自微信公众号 - AI算法与图像处理(AI_study)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。