“semantic segmentation” or “instance segmentation”.
a deep learning technique that gives you a per-pixel mask for the object. OpenCV: samples/dnn/segmentation.cpp
you could also try background segmentation, which requires a video, and the object to move/change markedly over time. OpenCV: Tutorials for bgsegm module