I utilized Python’s OpenCV2’s thresholding functions to generate masks for images. This script is really helpful for generating more data for supervised learning!

Below is what a mask looks like when applied to a picture of a horse.

Before:

After:

As you can see, the mask works really well in segmenting the object of interest from the background.