直方图均衡化取整怎么计算_直方图均衡化变换函数

Suppose that a given 3-bit image(L=8) of size 64*64 pixels (M*N=4096) has the intensity distribution shown as below. How to obtain histogram equalization transformation function

and then compute the equalized histogram of the image?

Rk nk

0 800

1 520

2 970

3 660

4 330

5 450

6 260

7 106

解决方案

"Histogram Equalization is the process of obtaining transformation function automatically. So you need not have to worry about shape and nature of transformation function"

So in Histogram equalization, transformation function is calculated using cumulative frequency approach and this process is automatic. From the histogram of the image, we determine the cumulative histogram, c, rescaling the values as we go so that they occupy an 8-bit range. In this way, c becomes a look-up table that can be subsequently applied to the image in order to carry out equalization.

rk nk c sk = c/MN (L-1)sk rounded value

0 800 800 0.195 1.365 1

1 520 1320 0.322 2.254 2

2 970 2290 0.559 3.913 4

3 660 2950 0.720 5.04 5

4 330 3280 0.801 5.601 6

5 450 3730 0.911 6.377 6

6 260 3990 0.974 6.818 7

7 106 4096 1.000 7.0 7

Now the equalized histogram is therefore

rk nk

0 0

1 800

2 520

3 0

4 970

5 660

6 330 + 450 = 780

7 260 + 106 = 366

The algorithm for equalization can be given as

Compute a scaling factor, α= 255 / number of pixels

Calculate histogram of the image

Create a look up table c with

c[0] = α * histogram[0]

for all remaining grey levels, i, do

c[i] = c[i-1] + α * histogram[i]

end for

for all pixel coordinates, x and y, do

g(x, y) = c[f(x, y)]

end for

But there is a problem with histogram equalization and that is mainly because it is a completely automatic technique, with no parameters to set. At times, it can improve our ability to interpret an image dramatically. However, it is difficult to predict how beneficial equalization will be for any given image; in fact, it may not be of any use at all. This is because the improvement in contrast is optimal statistically, rather than perceptually. In images with narrow histograms and relatively few grey levels, a massive increase in contrast due to histogram equalisation can have the adverse effect of reducing perceived image quality. In particular, sampling or quantisation artefacts and image noise may become more prominent.

The alternative to obtaining the transformation (mapping) function automatically is Histogram Specification. In histogram specification instead of requiring a flat histogram, we specify a particular shape explicitly. We might wish to do this in cases where it is desirable for a set of related images to have the same histogram- in order, perhaps, that a particular operation produces the same results for all images.

Histogram specification can be visualised as a two-stage process. First, we transform the input image by equalisation into a temporary image with a flat histogram. Then we transform this equalised, temporary image into an output image possessing the desired histogram. The mapping function for the second stage is easily obtained. Since a rescaled version of the cumulative histogram can be used to transform a histogram with any shape into a flat histogram, it follows that the inverse of the cumulative histogram will perform the inverse transformation from a fiat histogram to one with a specified shape.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值