Getting contour of important part

Background is not homogeous. You should try adaptativeThreshold or grab a new image with a constant background