做完第一周Matlab作业,深感MatLab之强大。(都第几周了,才做第一周作业...)
不在上图像处理这门课的同学,也可以试试在Matlab敲这些代码哦~ 用Matlab P图可有意思呢~
第一周是粗略地体验图像处理,先把题目要求贴上来:
Write a computer program capable of reducing the number of intensity levels in an image from 256 to 2, in integer powers of 2. The desired number of intensity levels needs to be a variable input to your program.
Using any programming language you feel comfortable with (it is though recommended to use the provided free Matlab), load an image and then perform a simple spatial 3x3 average of image pixels. In other words, replace the value of every pixel by the average of the values in its 3x3 neighborhood. If the pixel is located at (0,0), this means averaging the values of the pixels at the positions (-1,1), (0,1), (1,1), (-1,0), (0,0), (1,0), (-1,-1), (0,-1), and (1,-1). Be careful with pixels at the image boundaries. Repeat the process for a 10x10 neighborhood and again for a 20x20 neighborhood. Observe what happens to the image (we will discuss this in more details in the very near future, about week 3).
Rotate the image by 45 and 90 degrees (Matlab provides simple command lines for doing this).
For every 3×3 block of the image (without overlapping), replace all corresponding 9 pixels by their average. This operation simulates reducing the image spatial resolution. Repeat this for 5×5 blocks and 7×7 blocks. If you are using Matlab, investigate simple command lines to do this important operation.
=======================
实验用图
图像处理的第一件事,是找张图片。
盗用一张自诩为艺术家的好基友拍的照片,这是我们在拉萨约会时拍的.()
图片版权归好基友,转图请注明出处。
所谓的牦牛肉牛排,好韧的肉,要用好大力气吃... 还是肉牛做的牛排比较靠谱。
继续阅读“【MATLAB】P图神器,初露锋芒:第一周作业(剧透)”