-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo.py
More file actions
49 lines (35 loc) · 1.12 KB
/
demo.py
File metadata and controls
49 lines (35 loc) · 1.12 KB
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
from __init__ import image_data
import numpy as np
from getJmap_EM import getJmap_EM
from getJmapNA_EM import getJmapNA_EM
from main_files import smooth_unshift
from PIL import Image
from mat_fn import filt
import time
t=time.time()
ncomp=0
c2=6
#input image directory
image = image_data('florence2_tamp95_3_7.jpg')
########For NonAlign Image####################
LLRmap ,LLRmap_s, q1table, k1e, k2e, alphatable = getJmapNA_EM(image,ncomp,c2)
map_final = smooth_unshift(np.sum(LLRmap,2),k1e,k2e)
print 'Estimated Q1 Table' ,'\n',q1table.astype(int)
print 'Estimated alphatable' ,'\n',np.round(alphatable,4)
#eng.eval('imagesc('+n2m(map_final)+')')
im = Image.fromarray(np.uint8(map_final))
im.show()
'''
########For Align Image####################
LLRmap, LLRmap_s, q1table, alphatable = getJmap_EM(image,ncomp,c2)
#filter an array
map_final = filt(np.sum(LLRmap,2))
print 'Estimated Q1 Table' ,'\n',q1table.astype(int)
print 'Estimated alphatable' ,'\n',np.round(alphatable,4)
#create an array of result
im = Image.fromarray(np.uint8(map_final))
#show result as an image
im.show()
#print time taken by program
print time.time()-t
'''