All neccesary command lines are usually written at the end of the python file as a comment or in its own respective file in the corresponding folder. Simply run the command line in terminal. Remember to ensure you are in the right folder!
IMPORTANT: I have made a mistake and I misunderstood the task at hand as I used many of the OpenCV functions to solve the tasks. I was going throught everything a last time before I realised we where supposed to scan the image pixels and accessing them directly rather than use functions from OpenCV. I simply don't have enought time to redo all my tasks so I will instead make some python files to demonstrate that I understand the theory behind them. I hope this is acceptable given my situation
The code can be found in morphlogical_operators.py right next to this