Demo entry 1461877

conversion to Z

   

Submitted by MS on Mar 04, 2015 at 13:36
Language: Python. Code size: 852 Bytes.

import numpy
import pylab
import cv2

fileDir = "C:\\Users\\ms\\Desktop\\cb\\"
fileName = fileDir + "1_R.bin"

#fileName = "..//distances//120_R.bin"
#fileName = "..//images//synth3m_R.bin" #synthetic image

imSize = (1025,1280)
binRatio = 32

calDir = "C:\\Users\\ms\\Documents\\cam_range_calib\\"
#%% read calibration data (generated by calib.py)
xa = numpy.fromfile(calDir+"xa.bin",dtype=numpy.float32).reshape(imSize)
ya = numpy.fromfile(calDir+"ya.bin",dtype=numpy.float32).reshape(imSize)
za = numpy.fromfile(calDir+"za.bin",dtype=numpy.float32).reshape(imSize)

#%% read range data
imRange = numpy.fromfile(fileName,dtype=numpy.uint16)

#%% find bad values
badPts = numpy.nonzero(numpy.logical_or(imRange<10000,imRange>50000))[0]

#%% convert digital units to meters
imRange =  imRange.astype(numpy.float32)*0.00044-9.5

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).