未验证 提交 1e460576 编写于 作者: F fastislow 提交者: GitHub

Update 8.自动化特征提取器:图像特征提取和深度学习.md

修正 例 8-1 中错误代码格式
上级 5789d6cc
...@@ -62,8 +62,8 @@ SIFT最初是为对象识别的任务而开发的,它不仅涉及将图像正 ...@@ -62,8 +62,8 @@ SIFT最初是为对象识别的任务而开发的,它不仅涉及将图像正
```python ```python
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np from skimage import numpy as np
import data, color from skimage import data, color
# Load the example image and turn it into grayscale # Load the example image and turn it into grayscale
image = color.rgb2gray(data.chelsea()) image = color.rgb2gray(data.chelsea())
...@@ -78,8 +78,10 @@ gx[:, -1] = 0 ...@@ -78,8 +78,10 @@ gx[:, -1] = 0
gx[:, 1:-1] = image[:, :-2] - image[:, 2:] gx[:, 1:-1] = image[:, :-2] - image[:, 2:]
# Same deal for the vertical gradient # Same deal for the vertical gradient
gy = np.empty(image.shape, dtype=np.double) gy[0, :] = 0 gy = np.empty(image.shape, dtype=np.double)
gy[-1, :] = 0 gy[1:-1, :] = image[:-2, :] - image[2:, :] gy[0, :] = 0
gy[-1, :] = 0
gy[1:-1, :] = image[:-2, :] - image[2:, :]
# Matplotlib incantations # Matplotlib incantations
fig, (ax1, ax2, ax3) = plt.subplots(3, 1,figsize=(5, 9),sharex=True,sharey=True) fig, (ax1, ax2, ax3) = plt.subplots(3, 1,figsize=(5, 9),sharex=True,sharey=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册