def main(args):
"""
Entry point.
"""
# load the image
img = imread(args.input)
if img.ndim == 2:
img = gray2rgb(img)
elif img.shape[2] == 4:
img = img[:, :, :3]
upper_dim = max(img.shape[:2])
if upper_dim > args.max_dim:
img = rescale(img, args.max_dim/float(upper_dim), order=3)
# compute saliency
start = timeit.default_timer()
img_sal = compute_saliency(img)
runtime = timeit.default_timer() - start
print("Took {0} seconds.".format(runtime))
# save image
(fname, ext) = os.path.splitext(args.input)
out_path = fname + "_saliency" + ext
imsave(out_path, img_sal)
评论列表
文章目录