last commit fix

pull/4/head
vilda.novak@gmail.com 2013-11-11 13:18:41 +00:00
rodzic 4cdf1e967c
commit bea38a44b6
1 zmienionych plików z 31 dodań i 3 usunięć

Wyświetl plik

@ -148,10 +148,12 @@ def numpytoimage(a,iname):
a=a.reshape(d)
a=a.repeat(4)
a[3::4]=1
#i.pixels=a
i.pixels[:]=a[:]#this gives big speedup!
print('\ntime '+str(time.time()-t))
return i
def imagetonumpy(i):
t=time.time()
inc=0
@ -162,13 +164,39 @@ def imagetonumpy(i):
y=0
count=0
na=numpy.array((0.1),dtype=float)
if True:#bpy.app.debug_value==5:
if True:
size=width*height
na.resize(size*4)
id=0
#print(i.pixels[0])
na[:]=i.pixels[:]
na=na.reshape(width,height,4)
na=na[...,1]
#print(i.pixels[:20])
na=na[::4]
na=na.reshape(height,width)
na=na.swapaxes(0,1)
#print(na)
#na=na[...,1]
else:
na.resize(width,height)
#na=numpy.array(i.pixels)
percent=0
id=0
#progress(len(i.pixels))
#progress
for v in i.pixels:
if inc==0:
if x==width:
x=0
y+=1
#if int(y/height*100)>percent:
#percent=int(y/height*100)
#progress('zbuffer conversion',percent)
na[x,y]=v
#na.itemset(x,y,v)
x+=1
inc+=1;
if inc==4:
inc=0
print('\ntime '+str(time.time()-t))
return na