def __call__(self, image, test):
image_data = numpy.asarray(image, dtype=numpy.float32)[:, :, :3]
rgb_image_data = image_data.transpose(2, 0, 1)
lab_image_data = rgb2lab(image_data / 255).transpose(2, 0, 1).astype(numpy.float32)
luminous_image_data = lab_image_data[0].astype(numpy.uint8)
try:
th = threshold_otsu(luminous_image_data)
except:
import traceback
print(traceback.format_exc())
th = 0
linedrawing = (luminous_image_data > th).astype(numpy.float32)
linedrawing = numpy.expand_dims(linedrawing, axis=0)
return lab_image_data, linedrawing, rgb_image_data
comicolorization_task.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录