Upload
anh-minh-nguyen-duc
View
215
Download
0
Embed Size (px)
Citation preview
8/10/2019 Homework Chuyende2014
1/8
HOMEWORK
HW1.I/O image
a) Load the image cameraman.tif, using imread(), and show it using imshow().
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().
c) Get the breadth and height of the image, using MATLAB functionsize().
d) Get the values of light intensities of pixels [50:100, 50:100] and then show its
corresponding image patch.
e) Produce the following image.
chon loai tai anh cua
chieu rong
chieu cao
cuong do sng
anh dong vi rap noi
8/10/2019 Homework Chuyende2014
2/8
HW2.Color image
a) Load the image peppers.png and show it.
b) To understand how three colors RGB form the image, display each color component
image separately.
xai imread() , imshow()
rieng
8/10/2019 Homework Chuyende2014
3/8
c) Access R matrix and show the R values of pixels [50:100,50:100].
HW3. RGB, grayscale and binary images
a) Create and show the binary image [0 1; 1 0] with the proper magnification.
chia anh ra 4 mau
truy cap ma tran R va bieu dien gia tri R cua pixels
tao va bdien anh nhi phan
do phong dai rieng
8/10/2019 Homework Chuyende2014
4/8
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
can convert the image values from double type to unsigned integer 8 bitstype by using
unit8().
c) Convert peppers.pngimage to grayscale image using MATLAB function rgb2gray().
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().
HW4. Quantization
A typical digital image has pixel values between 0 and 255 represented in 8-bit numbers.
Now, suppose you are allowed to have only 5 bits to represent each pixel value, which
can only represent 32 different codes, but the pixel value should still be between 0 and
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
and 255.
The following is an example original 2x2 image represented in 8-bit pixels.
255 87
150 30
vung
chuyen gia tri image tu
sang cai grayscale
gia tri nguonganh den trang anh nhi phan
luong tu hoa
duoc bieu dien
chi cho 5 bit de bieu dien 1 diem anh
mu 5 =32 codec nhau
gan
sai so binh phuong trung binh
anh goc 2x2 duoc bieu dien bang 8 bit pixels
8/10/2019 Homework Chuyende2014
5/8
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
a) Guess how the following images look like when compared to the original image
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 = 1M, (N,M): size of original image.
Use lena.bmp as the original image (i.e. x[n,m]). Verify your guesses by displaying
resulting images of (i)(ii)(iii) in your report.
Use helpfliplr() andflipud() to see more information.
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,
movies, stc.)
HW6. Salt-pepper noise
Read in HW6.gif image, which contains salt-pepper (shot) noise.
dich anh ?
bieu thuc nao vs 5 bit code
du doan khi so sanh voi anh goc
bieu dienhien thi
ket qua tren bao cao
san xuat dang ve
dau co
nhieu muoi tieu
tac dung cua am ban trong y hoc, khoa hoc,phim anh
8/10/2019 Homework Chuyende2014
6/8
a)
Convolve with a box filter (all ones) to reduce the noise. Select a reasonable size totrade off noise and blurring. Display and submit.
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
image quality ?
HW7. Sharpening a blurred image
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.
chap voi bo loc de giam nhieu muoi tieu
giam nhoebo loc trung vi
bo chap tiep can thoa man
lam ro anh bi nhoe
thay A cho toi khi anh nohet nhoachap voi anh goc
8/10/2019 Homework Chuyende2014
7/8
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 useMatlab histogram equalization command.
HW9.Power-law transformation
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)
anh co do tuong phan thap dung phep bien doi power- law
hinh thai hoat dong
8/10/2019 Homework Chuyende2014
8/8