Feature extraction
As we saw in the earlier sections, filters can be used to isolate different frequencies using filters. By convolving an image with a Mexican hat filter, high frequencies are preserved, while using the box filter has the opposite effect. The difference between the filters in this section and the filters in the previous section is in specificity. The Mexican hat filter had no preference for direction. When there was an edge with sharp contrast (quick change in intensity), the filter had a strong effect. However, sometimes, you are only interested in a specific type of edge. Let's assume that we only want to detect vertical edges. The Mexican hat filter will give us all the edges in all directions, not just the vertical ones. This will be the topic of the following section.
Edge detection
To detect only vertical edges, we need to create a kernel that emphasizes pixels that are in a vertical orientation. The following kernels can detect different orientations of edges:

To perform...