Image Processing Best Practices — C++ Part 2

Soubhi Hadri
5 min readNov 3, 2020

It took me a lot of time to decide what is the best intro for this article. I should have published this article more than a year ago and I just want to say:

This article is a continuation to the first one. Please go back and check it out if you have not already, since it heavily depends on it.

We are going to cover the following in this article:
1. Implementation for Sobel filter through X axis (Vertically).
2. Implementation for Sobel filter through Y axis (Horizontally).
3.Implementation for Sobel filter through X and Y together.

Sobel filter

The main usage of Sobel filter is for Edge Detection. It does that by calculating the gradient of the image at each pixel which results in finding the largest increase from light to dark pixels and the rate of change. Edge can be defined as a set of contiguous pixel positions where a sudden change of the intensity values occur in the pixel. So:

Sobel Filter -> Edge Detection -> Object Boundaries.

The edges can be found by convolving 3x3 Sobel kernel through the image. The convolution process is done for every pixel in the image by multiplying each of the Sobel kernel values with the corresponding pixel values from…



Soubhi Hadri

Software Engineer at Microsoft. Former Computer Vision Engineer at Shiseido Group 資生堂. Interested in drones, CV, ML and DL.