*changed info logging to print statements
*fixed calculation of output files
This commit is contained in:
		
							parent
							
								
									5c631c8ca3
								
							
						
					
					
						commit
						4d4a7e72b3
					
				
					 1 changed files with 12 additions and 7 deletions
				
			
		| 
						 | 
					@ -5,13 +5,14 @@
 | 
				
			||||||
#    --output, -o, name of output file. if there are multiple input files, there will be a number prepended to this.
 | 
					#    --output, -o, name of output file. if there are multiple input files, there will be a number prepended to this.
 | 
				
			||||||
#    after all comamnd line arguments, file or files(space seperated) to process.
 | 
					#    after all comamnd line arguments, file or files(space seperated) to process.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import os.path
 | 
				
			||||||
import numpy as np
 | 
					import numpy as np
 | 
				
			||||||
import sys, argparse, laspy, logging
 | 
					import sys, argparse, laspy, logging
 | 
				
			||||||
import seaborn as sns; sns.set_theme()
 | 
					import seaborn as sns; sns.set_theme()
 | 
				
			||||||
import matplotlib.pyplot as plt
 | 
					import matplotlib.pyplot as plt
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
 | 
					logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def sort(array):
 | 
					def sort(array):
 | 
				
			||||||
    #sort by zDim column, first to last.
 | 
					    #sort by zDim column, first to last.
 | 
				
			||||||
| 
						 | 
					@ -43,14 +44,16 @@ def scale(array, xRange, yRange, maxX, maxY):
 | 
				
			||||||
def isInxyRange(xMin, xMax, yMin, yMax, xVal, yVal):
 | 
					def isInxyRange(xMin, xMax, yMin, yMax, xVal, yVal):
 | 
				
			||||||
    return (xMin<=xVal) and (xVal<xMax) and (yMin<=yVal) and (yVal<yMax)
 | 
					    return (xMin<=xVal) and (xVal<xMax) and (yMin<=yVal) and (yVal<yMax)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
imgX=100
 | 
					imgX=1000
 | 
				
			||||||
imgY=100
 | 
					imgY=1000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#TODO: make it iterate over multiple files.
 | 
					#TODO: make it iterate over multiple files.
 | 
				
			||||||
inFile = sys.argv[1]
 | 
					inFile = os.path.realpath(sys.argv[1])
 | 
				
			||||||
lasFile = laspy.file.File(inFile, mode = "r")
 | 
					lasFile = laspy.file.File(inFile, mode = "r")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
outFile = f'{imgX}*{imgY}{inFile}.png'
 | 
					outFile = f'{os.path.dirname(inFile)}/{imgX}*{imgY}{os.path.basename(inFile)}.png'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print(f'outputing to {outFile}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#import each dimention scaled.
 | 
					#import each dimention scaled.
 | 
				
			||||||
x = lasFile.x
 | 
					x = lasFile.x
 | 
				
			||||||
| 
						 | 
					@ -76,7 +79,9 @@ points = np.stack((x,y,z,intensity), axis=-1)
 | 
				
			||||||
# [x,y,z,intensity]]
 | 
					# [x,y,z,intensity]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logging.debug(f'points is\n{points}')
 | 
					logging.debug(f'points is\n{points}')
 | 
				
			||||||
logging.info(f'{points.shape[0]} points in LIDAR file.')
 | 
					print(f'{points.shape[0]} points in LIDAR file.')
 | 
				
			||||||
 | 
					#found experimentally.
 | 
				
			||||||
 | 
					print(f'estimated worst-case time is {points.shape[0]*7.77e-07*imgX*imgY} sec')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
xRange = maxes[xDim]-mins[xDim]
 | 
					xRange = maxes[xDim]-mins[xDim]
 | 
				
			||||||
yRange = maxes[yDim]-mins[yDim]
 | 
					yRange = maxes[yDim]-mins[yDim]
 | 
				
			||||||
| 
						 | 
					@ -107,7 +112,7 @@ for x in range(imgX):
 | 
				
			||||||
                zVal = scaledArray[i,zDim]
 | 
					                zVal = scaledArray[i,zDim]
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
        imageArray[x,y]=zVal
 | 
					        imageArray[x,y]=zVal
 | 
				
			||||||
        logging.info(f'zVal at {x},{y} is {zVal}')
 | 
					        print(f'zVal at {x},{y} is {zVal}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logging.debug(f'imageArray is {imageArray}')
 | 
					logging.debug(f'imageArray is {imageArray}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue