def get_real_images(paths):
real_images = []
for path in paths:
# Calculate a threshold to do image binarization, all colors at every pixel will be translated to number 0(white) or 1(black)
camera = io.imread(path)
val = filters.threshold_otsu(camera)
result = (camera < val)*1.0
real_images.append(result)
np_images = numpy.array(real_images)
np_images = np_images.reshape(np_images.shape[0], np_images.shape[1] * np_images.shape[2])
return np_images
评论列表
文章目录