-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.py
executable file
·50 lines (47 loc) · 1.58 KB
/
static.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -------------------------------------------------------------------------------
# Name: main
# Purpose: Testing the package pySaliencyMap
#
# Author: Akisato Kimura <akisato@ieee.org>
#
# Created: May 4, 2014
# Copyright: (c) Akisato Kimura 2014-
# Licence: All rights reserved
# -------------------------------------------------------------------------------
import cv2
import matplotlib.pyplot as plt
import pySaliencyMap
import time as time
# main
def static(img):
# read
# img = cv2.imread('test3.jpg')
# initialize
imgsize = img.shape[0]
img_width = imgsize[1]
img_height = imgsize[0]
start = time.time()
sm = pySaliencyMap.pySaliencyMap(img_width, img_height)
print(time.time()-start)
# computation
# saliency_map = sm.SMGetSM(img)
# binarized_map = sm.SMGetBinarizedSM(img)
# salient_region = sm.SMGetSalientRegion(img)
# # visualize
# # plt.subplot(2,2,1), plt.imshow(img, 'gray')
# plt.subplot(2,2,1), plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
# plt.title('Input image')
# # cv2.imshow("input", img)
# plt.subplot(2,2,2), plt.imshow(saliency_map, 'gray')
# plt.title('Saliency map')
# # cv2.imshow("output", map)
# plt.subplot(2,2,3), plt.imshow(binarized_map)
# plt.title('Binarilized saliency map')
# # cv2.imshow("Binarized", binarized_map)
# plt.subplot(2,2,4), plt.imshow(cv2.cvtColor(salient_region, cv2.COLOR_BGR2RGB))
# plt.title('Salient region')
# # cv2.imshow("Segmented", segmented_map)
#
# plt.show()
# # cv2.waitKey(0)
# cv2.destroyAllWindows()