b) Convert the resulting image into an 8-bit mask.
c) Copy a grayscale value into the original image where the Top Hat mask (from b) is nonzero.
Display the results.
14. Use cv::filter2D() to create a filter that detects only 60 degree lines in an image. Display the
results on a sufficiently interesting image scene.
15. Refer to the Sobel derivative filter shown in Figure 5-15. Make a kernel of this figure and convolve an
image with it. Then, make two kernels of the separable parts. Take the image again, and convolve with
first the x and then the y kernels. Subtract these two images to convince yourself that the separable
operation produces the exact same result.
16. Separable kernels. Create a 3-by-3 Gaussian kernel using rows [(1/16, 2/16, 1/16), (2/16, 4/16, 2/16),
(1/16, 2/16, 1/16)] and with anchor point in the middle.
a) Run this kernel on an image and display the results.
b) Now create two one-dimensional kernels with anchors in the center: one going “across” (1/4, 2/4,
1/4), and one going down (1/4, 2/4, 1/4). Load the same original image and use
cv::filter2D() to convolve the image twice, once with the first 1D kernel and once with the
second 1D kernel. Describe the results.
c) Describe the order of complexity (number of operations) for the kernel in part a) and for the
kernels in part b). The difference is the advantage of being able to use separable kernels ...