We talked about filters a lot, but they usually require only some sort of a matrix kernel and that is it. If you think that there should be more cool stuff in image filtering, you are totally right! First, we will see how to apply edge detection and how it works. In the final part, we will review the histogram equalization algorithm, which you probably use a lot if you have Photoshop.
Let's be curious; what if we threshold an image after the Sobel filter? Thresholding is done by iterating over all pixels of a grayscale image and checking whether the value exceeds the threshold value:
for (var i = 0; i < arr.length; i++) arr[i] = arr[i] > threshold ? 255 : 0;
This is what the threshold looks like. Just set the value to 255
if it is higher than the threshold and to 0
when it is not.
Here are several examples of different thresholds, each image having a higher threshold value than the previous:
See? The higher the threshold we set, the fewer...