Add function to count segment correspondences