*changed info logging to print statements

*fixed calculation of output files
This commit is contained in:
gabe venberg 2021-03-05 16:52:13 -06:00
parent 5c631c8ca3
commit 4d4a7e72b3

View file

@ -5,13 +5,14 @@
# --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.
import os.path
import numpy as np
import sys, argparse, laspy, logging
import seaborn as sns; sns.set_theme()
import matplotlib.pyplot as plt
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):
#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):
return (xMin<=xVal) and (xVal<xMax) and (yMin<=yVal) and (yVal<yMax)
imgX=100
imgY=100
imgX=1000
imgY=1000
#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")
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.
x = lasFile.x
@ -76,7 +79,9 @@ points = np.stack((x,y,z,intensity), axis=-1)
# [x,y,z,intensity]]
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]
yRange = maxes[yDim]-mins[yDim]
@ -107,7 +112,7 @@ for x in range(imgX):
zVal = scaledArray[i,zDim]
break;
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}')