Imported from https://github.com/josedolz/UnbiasedShapeCompactness