Topic: Pseudorandom thresholding is an image halftoning method that created to solve the issue of false contours, which are created when using gray-level binary fonts. A matrix know as dither matrix is used, which can be calculated recursively if its size is a power of 2. Such a matrix contains integer elements, known as thresholds, that must be scaled before being applied to the image. Each pixel value is compared to an appropriate threshold (in an ordered manner) and depending on the result, it is set to either black or white.


Exercise: Create a Python script file and perform the following tasks:

  • Import OpenCV and NumPy libraries.
  • Create a function that takes as input a grayscale image and the size of the dither matrix and performs pseudorandom thresholding. Then, return the halftoned image. You can add any extra parameters you desire.
  • Read an image as grayscale.
  • Apply pseudorandom thresholding to the greyscale image.
  • Finally, display the original and halftoned images side-by-side.

Instructions and Material for solution: Click Image to download the exercise material.

Help (if needed): Click Pdf  to download the exercise help.

Lecture for better understanding: https://icarus.csd.auth.gr/digital-image-processing/

This exercise was developed by C. Georgiadis.

————————————————————————————————————–

For the solutions to the exercises, please contact koroniioanna@csd.auth.gr