python图像处理-----图像增强(空间域)
1.反转变换 反转变换:s = (L-1) - r
def fan_zhuan_bian_huan(image):
a,b = image.shape[:2]
img = np.zeros((a,b),dtype=np.uint8)
for i in range(a):
for j in range(b):
img[i][j] = 255 - image[i][j]
return img
2.对数变换 对数变换:s = c log(k+r)
def dui_shu_bian_huan(image,c,k):
a,b = image.shape[:2]
img = np.zeros((a,b),dtype=np.uint8)
for i in range(a):
for j in range(b):
img[i][j] = c * math.log(k+image[i][j],2)
return img
3.指数变换 【python图像处理-----图像增强(空间域)】指数变换:s = c r^γ
def zhi_shu_bian_huan(image,c,gamma):
a,b = image.shape[:2]
img = np.zeros((a,b),dtype=np.uint8)
for i in range(a):
for j in range(b):
img[i][j] = 256 * c * math.pow(image[i][j]/256,gamma)
return img
推荐阅读
- python学习之|python学习之 实现QQ自动发送消息
- 逻辑回归的理解与python示例
- Java|Java OpenCV图像处理之SIFT角点检测详解
- python自定义封装带颜色的logging模块
- 【Leetcode/Python】001-Two|【Leetcode/Python】001-Two Sum
- Python基础|Python基础 - 练习1
- Python爬虫|Python爬虫 --- 1.4 正则表达式(re库)
- Python(pathlib模块)
- python青少年编程比赛_第十一届蓝桥杯大赛青少年创意编程组比赛细则
- Python数据分析(一)(Matplotlib使用)