1.Write down a 3x3 filter that returns a positive value if the average value of the 4-adjacent neighbors is less than the center and a negative value otherwise.
we need to design the filter in such a way that it emphasizes the center pixel while subtracting the average contribution of its four immediate neighbors
the filter can be :
[
0
−
1
0
−
1
4
−
1
0
−
1
0
]
\left[\begin{matrix} 0& -1 & 0\\ -1&4&-1 \\ 0& -1&0 \end{matrix}\right]
0−10−14−10−10
or :
[
0
−
1
/
4
0
−
1
/
4
1
−
1
/
4
0
−
1
/
4
0
]
\left[\begin{matrix} 0& -1/4 & 0\\ -1/4&1&-1/4 \\ 0& -1/4&0 \end{matrix}\right]
0−1/40−1/41−1/40−1/40
The center position (2,2) has a coefficient of 4 because we want to subtract the average value of the four neighbors from the center value. Since we are dealing with an average and there are four neighbors, multiplying the center value by 4 allows for this operation in a single step when the kernel is applied.
2.Write down a filter that will compute the gradient in the x-direction:
gradx(y,x) = im(y,x+1) - im(y,x) for each x, y
Since the operation only involves the current and the right pixel, a 2x2 or even a 1x2 filter is technically sufficient for this specific computation.
The filter for computing gradx(y,x) is: [ − 1 1 ] \left[\begin{matrix} -1 & 1\\ \end{matrix}\right] [−11]
The value −1 is applied to the current pixel im(y,x), and the value 1 is applied to the pixel to its immediate right im(y,x+1).When this filter is applied across an image, it effectively calculates the difference between each pixel and its neighbor to the right, which corresponds to the horizontal gradient.
3.Fill in the blanks:
a) G
= D * B
b) A = B
* C
c) F = D * E
d) I
= D * D
analyze the images:
‘A’ is a blurred image, which suggests that ‘B’ is a blurring kernel (low-pass filter).
‘E’ may be a step function or a representation of a binary image
‘F’ shows the edges in ‘D’, which is typically the result of a high-pass filter or an edge detection operation
‘G’ could potentially be a high-pass filter, as it seems to emphasize the edges and textures.
‘H’ is another blurred image, possibly the result of applying a different type of blur than ‘A’.
‘I’ looks like a gradient image, possibly the result of a gradient filter applied to ‘D’.