为什么在第256行和第256列中没有蓝线?

时间:2019-05-17 09:56:28

标签: python scikit-image

考虑以下示例:

import numpy as np
from scipy import ndimage as nd
import matplotlib.pyplot as plt
from skimage import io
%matplotlib inline

url_astronaut = ('https://raw.githubusercontent.com/scikit-image/scikit-image/master/skimage/data/astronaut.png')
image_gridded = io.imread(url_astronaut)
image_gridded[128:-1:128, :] = [0, 0, 255]
image_gridded[:, 128:-1:128] = [0, 0, 255]

plt.imshow(image_gridded);

结果是

enter image description here

np.arange(512)[128:-1:128]array([128, 256, 384]),为什么在第256行和第256列中没有蓝线?

此示例来自https://github.com/elegant-scipy/notebooks/blob/master/notebooks/ch3.ipynb

1 个答案:

答案 0 :(得分:1)

您的代码工作正常,并且行实际上在图像中,但是它们未显示在输出“预览”中。如果放大图像,则会看到蓝线出现。