kopia lustrzana https://github.com/vilemduha/blendercam
				
				
				
			last commit fix
							rodzic
							
								
									4cdf1e967c
								
							
						
					
					
						commit
						bea38a44b6
					
				|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 vilda.novak@gmail.com
						vilda.novak@gmail.com