Codes are from below https://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/