Added compactness measurement to object detection.