Extracting depth coordinate from centroid