数字图像处理实验1-降低图像灰度级、双线性插值实现图像放缩

本实验使用Matlab实现图像灰度级从256降至2的整数幂,以及通过双线性插值进行图像的缩放。降低了灰度级的图像被展示,同时比较了双线性插值缩放前后图像的质量差异,指出放大过程中的模糊是由于平滑滤波导致的图像细节损失。
摘要由CSDN通过智能技术生成

Assignment #1

  1. Reducing the Number of Gray Levels in an Image
    (a) Write a computer program capable of reducing the number of gray levels in an image from 256 to 2, in integer powers of 2. The desired number of gray levels needs to be a variable input to your program.
    (b) Download Fig. 2.21(a) and duplicate the results shown in Fig. 2.21 of the book.

  2. Zooming and Shrinking Images by Bilinear Interpolation
    (a) Write a computer program capable of zooming and shrinking an image by bilinear interpolation. The input to your program is the desired size of the resulting image in the horizontal and vertical direction. You may ignore aliasing effects.
    (b) Download Fig. 2.19 and use your program to shrink this image from 1024 x 1024 to 256 x 256 pixels.
    © Use your program to zoom the image in (b) back to 1024 x 1024. Explain the reasons for their differences.

一、技术实现
1.降低图像灰度级
灰度图像是一种单色图像,该图像只有灰度等级,没有颜色变化。图像的灰度级是指图像中的亮度的最大值与最小值之差的级别,级数越多,图像的亮度范围越大,图像质量越高,级数越少则图像质量越差,当图像只有两个灰度色阶时,成为二值图像。
本实验中,要实现写一个Matlab函数,输入一个图像和整数n,给定图像的灰度级将以2的n次方减少,所采用的量化方法为:
灰度级数=(原灰度级数/量化级数)*量化级数n

2.双线性插值
双线性插值又称双线性内插,双线性插值算法通过计算原图像四个点的像素质来填充目标像素,并根据四个点对填充点的像素贡献度不一样而采用不同的权值,这样带来了平滑滤波的效果,使得图像的细节差生退化。
双线性差值公式:

在这里插入图片描述
在这里插入图片描述
二、实验结果
1.降低图像灰度级
输入图片Fig.2.21(a),并将图像灰度级将为2。
在这里插入图片描述
2.双线性差值实现图像的缩放
将Fig.2.19(a)由10241024缩小为256 256
在这里插入图片描述
将缩小为256256的图像再放大为1024 1024
在这里插入图片描述
对比同为1024*1

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值