How much do you know about steganography? The simplest algorithm (which is what your assignment is implementing) is the least significant bit (LSB). In short, you convert your message to binary (i.e. character 'a' = 01100001) and write the individual bits in the rightmost bits of the pixel values. For example, take 8 pixels (each represented by a byte) and in the first byte hide a 0, in the second 1, in the third 1, in the fourth 0, etc. To extract your message, obtain the binary string from the LSB in your pixels and convert it back to text.
Your teacher gave you the hiding algorithm, so basically you have to write an algorithm which reverses the process. You don't need to look further than that, you just have to understand what this code does. Just the inline comments should be enough.