Digital Image Processing in C (Chapter 9): Thresholding, Roberts, Prewitt, Sobel, and Edge Detection

Zhe LIN
11 min readJan 9, 2024

0. Complete Code

The complete code for this chapter is available in: Chapter 9. Thresholding, Roberts, Prewitt, Sobel, and Edge Detection

For more chapters on digital image processing and all original images, see: Introduction to Digital Image Processing

Please give my repository a star ⭐️ if you like it.

1. Image Gradient and Thresholding

1.1 Roberts:

The Roberts edge operator is a 2*2 mask that uses the difference between two diagonally adjacent pixels, and then takes the sum of the squares of the differences between the two diagonal pixels. The template is showing as:

And the algorithms are:

Results (headCT_Vandy, building_original, noisy_fingerprint):

--

--

Zhe LIN

Zhe studied Computer Science in Hong Kong and is currently pursuing a Master degree in the United States. Really hope my article is helpful to you!