Latest Page Update: 23-09-2026
Solution is now available! Download the full solution from here: Solution
Exercise3 - Pixelwise operations¶
In this exercise you will learn to perform pixelwise operations using Python.
Learning Objectives¶
After completing this exercise, the student should be able to do the following:
- Convert from unsigned byte to float images using the scikit-image function
img_as_float - Convert from float to unsigned byte images using the scikit-image function
img_as_ubyte - Implement and test a function that can do linear histogram stretching of a grey level image.
- Implement and test a function that can perform gamma mapping of a grey level image.
- Implement and test a function that can threshold a grey scale image.
- Use Otsu's automatic method to compute an optimal threshold that seperates foreground and background
- Perform RGB thresholding in a color image.
- Convert a RGB image to HSV using the function
rgsb2hsvfrom theskimage.colorpackage. - Visualise individual H, S, V components of a color image.
- Implement and test thresholding in HSV space.
- Implement and test a program that can do perform pixelwise operations on a video stream
Installing Python packages¶
In this exercise, we will be using both scikit-image and OpenCV. You should have both libraries installed, else instructions can be found in the previous exercises.
We will use the virtual environment from the previous exercise (course02503).
Exercise data and material¶
Download the data you'll need for this exercise by clicking here: Data
Alternatively, you can also fetch the data for the whole course through the Image Analysis GitHub repository. See the Data and GitHub section for more information. If you're using Git, it may be wise run:
git pull
As this will fetch updates to the material, which may happen throughout the course.