skimage.morphology中的深度学习语法错误

时间:2020-04-21 18:12:23

标签: python deep-learning feature-extraction scikit-image

我有一段python代码,旨在提取字母并标记包含图像的每个区域。

编辑:我正在使用Google Colab

我收到以下错误:

 print label_image.max()
                    ^
SyntaxError: invalid syntax

我尝试回溯python等版本,但未找到解决方案。任何帮助表示感谢。 完整代码:

import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from scipy.misc import imread,imresize
from skimage.segmentation import clear_border
from skimage.morphology import label
from skimage.measure import regionprops


image = imageio.imread('https://pbs.twimg.com/profile_images/985792111713947648/7YD1ZYpe_400x400.jpg')



#apply threshold in order to make the image binary
bw = image < 120

# remove artifacts connected to image border
cleared = bw.copy()
clear_border(cleared)

# label image regions
label_image = label(cleared,neighbors=8)
borders = np.logical_xor(bw, cleared)
label_image[borders] = -1

print label_image.max()

fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))
ax.imshow(bw, cmap='jet')


0 个答案:

没有答案