$30
BACKGROUND.
In Lecture 3 we looked at chroma key segmentation. In this exercise you will analyse a picture taken in front of a green background and replace the background with another image. On Canvas you will find the input image Girl_in_front_of_a_green_background.jpg and the target image
Tour_Eiffel.jpg.
Task 1.
Load and display the input image and the target image. Convert the input image into HSV colour representation and extract the Hue channel. Also display the Hue channel image.
Task 2.
Calculate and display the histogram of the Hue channel image to determine the thresholds for removing the green background. Apply the thresholds to the Hue channel image to calculate a binary mask of the foreground. Display the foreground mask.
Task 3.
Cut out the foreground from the input image and resize the cut-out to 300x200 pixels. Replace the pixels of the target image with the cut-out, so that the foreground appears at the bottom in the middle of the target image. Display the final result.