In [42]:
%load_ext autoreload
%matplotlib inline
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
from skimage.io import imread


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [47]:
from salientdetect import saliency_score_from_ndarry

In [48]:
from urllib.request import urlopen

img = imread(urlopen("http://www.wisdom.weizmann.ac.il/~vision/Seg_Evaluation_DB/1obj/Bream_In_Basin/Src_Color/slides/Bream_In_Basin.jpg"))
plt.imshow(img, interpolation='nearest', aspect='auto')


Out[48]:
<matplotlib.image.AxesImage at 0x11a663cc0>

In [49]:
ret = saliency_score_from_ndarry(img)

In [50]:
out_pixels = []
out = np.zeros(img.shape, dtype=np.uint8)

for s, pixels in ret.items():
    # s is saliency score
    if s < 5:
        continue
    for x, y in pixels:
        out[y, x][0] = 255
        out[y, x][1] = 255
        out[y, x][2] = 255
plt.imshow(out, interpolation='nearest', aspect='auto')


Out[50]:
<matplotlib.image.AxesImage at 0x11af6e630>