Professional Documents
Culture Documents
Question 1: The two texture images shown below are quite different, but their histograms are identical.
Both images have size 80 × 80, with black (0) and white (1) pixels.
Suppose that both images are blurred with a 3× 3 smoothing mask. Would the resultant
histograms still be the same? Draw the two histograms and explain your answer.
Solution
m=[0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;
0 0 0 0 1 1 1 1;]
n=[0 1 0 1 0 1 0 1;
1 0 1 0 1 0 1 0;
0 1 0 1 0 1 0 1;
1 0 1 0 1 0 1 0;
0 1 0 1 0 1 0 1;
1 0 1 0 1 0 1 0;
0 1 0 1 0 1 0 1;
1 0 1 0 1 0 1 0;]
subplot(1,2,1),imhist(m);
subplot(1,2,2),imhist(n);
Question 2: Given a gray image I, we want to find all its pixels that are in the domain [a, b]. Design
a matlab function F = f(I, a, b) that returns a binary matrix F that is of the same size as I,
where 1 for pixels satisfying the domain condition and 0 otherwise.
Solution
.......................................................................................................................................................................
.......................................................................................................................................................................
.......................................................................................................................................................................
.......................................................................................................................................................................
.......................................................................................................................................................................
.......................................................................................................................................................................
Question 3: Viết Matlab script thực hiện đếm số đối tượng (5 đối tượng) trong hình sau:
Solution
Isp = imread('question3.png');
k=fspecial('gaussian',[5 5],2);
Isp_g=imfilter(Isp,k);
level = graythresh(Isp_g);
bwImg = 1 - im2bw(Isp_g, level);
L = bwlabel(bwImg, 4);
rgbLabel = label2rgb(L, 'jet','k');
Question 4: Write a matlab script code to: Detecting a Cell Using Image Segmentation:
- Read in 'cell.tif' , which is an image of a prostate cancer cell.
Solution
I = imread('cell.tif');
figure();