python批量直方图均衡化_【图像处理】直方图均衡化基于python实现

读图像、显示图像采用opencv接口,算法主体用python编写

算法步骤在代码中详细体现。

代码如下:

#!/usr/bin/python3

# -*- coding: utf-8 -*-

'直方图均衡化函数,0::28 2019/06/20'

__author__ = 'mint'

import numpy as np

import cv2 as cv

#创建空列表(数组)

def createEmptyList(size):

newList = []

for eachNum in range(0, size):

newList.append(0)

return newList

#创建空图像矩阵

def createEmptyImage(rows, cols,type):

img = np.zeros((rows, cols), dtype=type)

return img

#直方图均衡化

def histequaLize(src, dst):

#step 1 校验参数#

assert(type(src)==np.ndarray)

assert(src.dtype == np.uint8)

assert (type(dst) == np.ndarray)

assert (dst.dtype == np.uint8)

# step 2 直方图统计#

hist = createEmptyList(256)

rows, cols

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值