小编use*_*255的帖子

局部直方图均衡

我试图在python中使用一些图像分析(我必须使用python).我需要进行全局和局部直方图均衡化.全局版本运行良好,但本地版本使用7x7足迹,结果非常差.

这是全球版本:

   import matplotlib.pyplot as plt
   import matplotlib.image as mpimg
   from scipy  import ndimage,misc
   import scipy.io as io
   from scipy.misc import toimage
   import numpy as n
   import pylab as py
   from numpy import *

   mat = io.loadmat('image.mat')
   image=mat['imageD']

   def histeq(im,nbr_bins=256):
     #get image histogram
     imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
     cdf = imhist.cumsum() #cumulative distribution function
     cdf = 0.6 * cdf / cdf[-1] #normalize
     #use linear interpolation of cdf to find new pixel values
     im2 = interp(im.flatten(),bins[:-1],cdf)
     #returns image and cumulative histogram used to …
Run Code Online (Sandbox Code Playgroud)

python numpy image filter histogram

6
推荐指数
1
解决办法
3948
查看次数

标签 统计

filter ×1

histogram ×1

image ×1

numpy ×1

python ×1