Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Computer Vision for the Web

You're reading from  Computer Vision for the Web

Product type Book
Published in Oct 2015
Publisher Packt
ISBN-13 9781785886171
Pages 116 pages
Edition 1st Edition
Languages
Author (1):
Foat Akhmadeev Foat Akhmadeev
Profile icon Foat Akhmadeev

Advanced image processing


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.

The Canny edge detector

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}