def sharpen(img): rh, rw, rc = img.shape img2 = np.zeros((rh, rw, 3), dtype=np.uint8); kernel_size = 3 scale = 1 delta = 0 ddepth = cv2.CV_64F img2 = cv2.convertScaleAbs(cv2.Laplacian(img,ddepth,ksize = kernel_size,scale = scale,delta = delta)) sharpened = cv2.addWeighted(img, 1, img2, -0.5, 0) cv2.imshow('original img', img) cv2.imshow('sharpened img', sharpened) cv2.waitKey(5000) cv2.destroyAllWindows()
def is_blurred(gray_frame, threshold): blurness = np.max(cv2.convertScaleAbs(cv2.Laplacian(gray_frame, cv2.CV_64F))) if blurness > threshold: return False else: return True
def is_blurred(gray_frame, threshold): blurness = np.max(cv2.convertScaleAbs(cv2.Laplacian(gray_frame,cv2.CV_64F))) if(blurness > threshold): return False else: return True
def get_blurriness(gray_img): blurriness = np.max(cv2.convertScaleAbs(cv2.Laplacian(gray_img,8))) print blurriness return blurriness
def get_blurriness(gray_img): blurriness = np.max(cv2.convertScaleAbs(cv2.Laplacian(gray_img, 8))) print blurriness return blurriness