Working basis. TODOs are included in the code, as well as the merging of the HSV mask (which still needs to be completed).