2020
10-04
10-04
python 图像判断,清晰度(明暗),彩色与黑白实例
1,判断图像清晰度,明暗,原理,Laplacian算法。偏暗的图片,二阶导数小,区域变化小;偏亮的图片,二阶导数大,区域变化快。importcv2defgetImageVar(imgPath):image=cv2.imread(imgPath)img2gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)imageVar=cv2.Laplacian(img2gray,cv2.CV_64F).var()returnimageVarimageVar=getImageVar("./lena.jpg")print(imageVar)输出结果:2119.09135813516972,判断黑白或...
继续阅读 >