You are on page 1of 8

HOMEWORK

HW1. I/O image


a) Load the image cameraman.tif, using imread(), and show it using imshow().

chon loai tai anh cua


b) Get the type of the loaded image data using MATLAB function class(), and get the
maximum and minimum data value for this image using MATLAB function max() and
min().

chieu rong
c) Get the breadth and height of the image, using MATLAB function size().
chieu cao
d) Get the values of light intensities of pixels [50:100, 50:100] and then show its
cuong do sng
corresponding image patch.
rap noi
anh dong vi

e) Produce the following image.

HW2. Color image


a) Load the image peppers.png and show it.
xai imread() , imshow()

b) To understand how three colors RGB form the image, display each color component
image separately.
rieng

chia anh ra 4 mau

c) Access R matrix and show the R values of pixels [50:100,50:100].


truy cap ma tran R va bieu dien gia tri R cua pixels
HW3. RGB, grayscale and binary images
do phong dai rieng
a) Create and show the binary image [0 1; 1 0] with the proper magnification.
tao va bdien anh nhi phan

b) Create and show the grayscale image [0 16 32 64 128 255; 255 128 64 32 0] with the
proper magnification. $ote: by default, the range is 0 to 1 (type: double); however, you
vung
can convert the image values from double type to unsigned integer 8 bits type by using
unit8(). chuyen gia tri image tu

sang cai grayscale


c) Convert peppers.png image to grayscale image using MATLAB function rgb2gray().
anh den trang
anh nhi phan
gia tri nguong
d) Convert the above gray image to binary image by thresholding with the threshold
values 50, 100, 150, 200, 250. MATLAB function to convert a gray image to a binary
image is im2bw().

luong tu hoa
HW4. Quantization
duoc bieu dien
A typical digital image has pixel values between 0 and 255 represented in 8-bit numbers.
chi cho 5 bit de bieu dien 1 diem anh
Now, suppose you are allowed to have only 5 bits to represent each pixel value, which

2 mu 5 =32 code can only represent 32 different codes, but the pixel value should still be between 0 and
gan
khac nhau
255 for display. The codes should be assigned to represent values in order to minimize
the mean square error when the original pixel values are uniformly distributed between 0
sai so binh phuong trung binh
and 255.
anh goc 2x2 duoc bieu dien bang 8 bit pixels
The following is an example original 2x2 image represented in 8-bit pixels.
255 87
150 30

bieu thuc nao vs 5 bit code


With the new 5-bit codes, what are the values of the resulting image? What are the pixel
values of the resulting images if you only have 3-bit codes?
HW5. Flipped and negative images dich anh ?
a) Guess how the following images look like when compared to the original image
du doan
khi so sanh voi anh goc
x[n,m]
(i) x[-n+1, m]
(ii) x[n, M-m+1]
(iii) x[-n+1, M-m+1]
where n = 1N, m = 1  M, (N,M): size of original image.

hien thi
Use lena.bmp as the original image (i.e. x[n,m]). Verify your guesses by displaying
bieu dien
resulting images of (i)(ii)(iii) in your report.
ket qua tren bao cao
Use help fliplr() and flipud() to see more information.

san xuat
dang ve
b) Produce the negative of the lena.bmp image. Describe the visual appearance of the
final result and speculate how this might be used in some practical applications (science,
dau co
movies, stc.)
tac dung cua am ban trong y hoc, khoa hoc,phim anh
HW6. Salt-pepper noise nhieu muoi tieu
Read in HW6.gif image, which contains salt-pepper (shot) noise.

chap voi bo loc de giam nhieu muoi tieu


a) Convolve with a box filter (all ones) to reduce the noise. Select a reasonable size to
trade off noise and blurring. Display and submit.
giam
nhoe
bo loc trung vi
b) Now apply a 3 x 3 and 5x5 median filter to the image and compare the result with the
convolutional filter. Display and submit. Which approach is more satisfying in terms of
bo chap
tiep can
thoa man
image quality ?
HW7. Sharpening a blurred image lam ro anh bi nhoe
Read in a 512x512 blurred image HW7.jpg, which should look like it was taken from a
defocused camera. Try the spatial domain high-boost filter on this image and report your
result.

thay A cho toi khi anh no


het nhoa
chap voi anh goc

HW8. Histogram equalization


Read in the low contrast image HW8.jpg. Perform the histogram equalization for the
image. Note: due to the quantization of the image levels, you will not be able to achieve a
perfectly flat histogram. In fact, it will have large 'holes' and 'spikes' in it. It is OK to use
Matlab histogram equalization command.

HW9. Power-law transformation


dung phep bien doi power- law
anh co do tuong phan thap
Based on the low contrast image HW8.jpg again, please use the power-law transform,
i.e., s = c.r, to enhance the image. First, you have to decide the value of power (should
be > 1 or < 1?), then appropriately select the scaling constant c to ensure the resulting
gray level values fall within [0, 255]. Please choose three different values and report
which of the three images is most pleasing to your eye, and why? Please also show the
resulting images and the corresponding histograms.
HW10. Morphological operations (done)
hinh thai hoat dong

You might also like