Let's use the logical operations to do some fund stuff.

Before we move on, try to understand why RGB images has 3 colors.
Look at the following figure, other colors can be created by the combination of the R, G, and B components.

For the following image processing tasks, you will have to separate the RGB images into 3 slices, and then process one by one, then combine them. Just following the tutorial, you will get it.

1. Download the foreground figure here.
Have your script file in the same directory, then use the following script to show the figure:

Check the generated 's' in your workspace, do you understand the three numbers in 's'?

They mean the size of the image is 480 pixels x 852 pixels by 3 layers. Why 3 layers? The image has Red, Green, and Blue, 3 layers. It is a RGB file.

Now, let's pick up a background image for this foreground. Download the background here:
Now you should see two images:

Now, let's extract the person from the left figure, merge the extracted image to the one on the right.

To understand the code better, you probably need to go back to last lecture's tutorials.
You should see a merged figure:

2. Download the figure from here:
Use the following code to plot the intensity profile of the figure:

You should see the following plot. Note that the thin white line drawn in the middle of the figure, and the profile of the intensity was drawn along the line.

Task 1:
Repeat the first example shown in the tutorial.

Task 2:
Repeat the second example shown in the tutorial.

Task 3:

Subplot ‘laser.png’ and its profile in one figure set (two sub-figures). The profile line is a at column 600, and all the rows. Plot the R, G, and B profiles at that line in the same sub-figure. Email me your html with the plotting on it.

An example from the class: (note that you are plotting a column profile but not a row profile like I did in this example)

Send your work to the email by Monday.