📜  超像素 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:36.670000             🧑  作者: Mango

代码示例1
def superpixel(image, size=(4, 7)):
    segments = np.zeros([image.shape[0], image.shape[1]])
    row_idx, col_idx = np.where(segments == 0)
    for i, j in zip(row_idx, col_idx):
        segments[i, j] = int((image.shape[1]/size[1]) * (i//size[0]) + j//size[1])
    return segments