def blur_measure(im):
""" See cv::videostab::calcBlurriness """
H, W = im.shape[:2]
gx = cv2.Sobel(im, cv2.CV_32F, 1, 0)
gy = cv2.Sobel(im, cv2.CV_32F, 0, 1)
norm_gx, norm_gy = cv2.norm(gx), cv2.norm(gy)
return 1.0 / ((norm_gx ** 2 + norm_gy ** 2) / (H * W + 1e-6))
评论列表
文章目录