27.01.2015 Views

how to get started in Linux with the Microsoft Kinect - Stony Brook ...

how to get started in Linux with the Microsoft Kinect - Stony Brook ...

how to get started in Linux with the Microsoft Kinect - Stony Brook ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Calibration<br />

Figure 2: My calibration board. (<strong>to</strong>p) Here we see <strong>the</strong><br />

process <strong>with</strong> <strong>the</strong> IR emitter blocked, <strong>with</strong> <strong>the</strong> corners.<br />

(bot<strong>to</strong>m) calibration process for <strong>the</strong> IR image.<br />

Without calibration, <strong>the</strong> color and depth outputs<br />

from <strong>the</strong> cameras are useless data. The camera’s <strong>in</strong>tr<strong>in</strong>sic<br />

and extr<strong>in</strong>sic parameters are fac<strong>to</strong>ry set and<br />

it is necessary <strong>to</strong> determ<strong>in</strong>e a translation from <strong>the</strong><br />

camera frame <strong>to</strong> <strong>the</strong> world frame. The <strong>in</strong>tr<strong>in</strong>sic parameters<br />

are: focal length, camera sensor size, lens<br />

dis<strong>to</strong>rtion measured as a radial dis<strong>to</strong>rtion, and image<br />

plane displacement measured as displacement from<br />

<strong>the</strong> optical axis. In <strong>the</strong> o<strong>the</strong>r hand, <strong>the</strong> extr<strong>in</strong>sic parameters<br />

are <strong>the</strong> camera location (vec<strong>to</strong>r) and <strong>the</strong><br />

camera rotation (as Euler angles). The cameras are<br />

calibrated us<strong>in</strong>g <strong>the</strong> p<strong>in</strong>hole model, where <strong>the</strong> view of<br />

<strong>the</strong> scene is created by project<strong>in</strong>g a set of 3D po<strong>in</strong>ts<br />

on<strong>to</strong> <strong>the</strong> image plane via perspective transformation.<br />

We can create a depth annotation of a chessboard<br />

rig by physically offsett<strong>in</strong>g <strong>the</strong> chessboard from its<br />

background. The offset creates sharp edges <strong>in</strong> depth<br />

along <strong>the</strong> perimeter of <strong>the</strong> chessboard mount<strong>in</strong>g<br />

which rema<strong>in</strong> fixed <strong>with</strong> respect <strong>to</strong> <strong>the</strong> chessboard’s<br />

<strong>in</strong>terior corners. By co<strong>in</strong>cid<strong>in</strong>g <strong>the</strong> chess- board’s exterior<br />

corners <strong>with</strong> <strong>the</strong> sharp edges <strong>in</strong> depth, <strong>the</strong>re is<br />

no need <strong>to</strong> measure <strong>the</strong> position<strong>in</strong>g of <strong>the</strong> chessboard<br />

<strong>with</strong> respect <strong>to</strong> <strong>the</strong> mount<strong>in</strong>g; only <strong>the</strong> dimension of<br />

a s<strong>in</strong>gle chessboard square is needed.<br />

The calibration steps for <strong>the</strong> IR and <strong>the</strong> RGB cameras<br />

we proceed as follow:<br />

1. I created a calibration tar<strong>get</strong>: a chessboard<br />

pr<strong>in</strong>ted on a4.pdf, where each square is 0.023<br />

m 2 , as <strong>in</strong> Fig. 2.<br />

2. I <strong>to</strong>ok 20 <strong>with</strong> <strong>the</strong> IR emitter blocked (for <strong>the</strong><br />

stereo camera calibration) and 20 <strong>with</strong> none of<br />

<strong>the</strong> cameras blocked, mak<strong>in</strong>g sure <strong>the</strong> corners of<br />

<strong>the</strong> tar<strong>get</strong> are always <strong>in</strong> <strong>the</strong> image and <strong>get</strong>t<strong>in</strong>g<br />

different angles and placements.<br />

3. I run a code written <strong>with</strong> <strong>the</strong> OpenCV calibration<br />

functions (see git repo [8]) for <strong>the</strong><br />

above images, aim<strong>in</strong>g a pixel reprojection error<br />

smaller than 1. The OpenCV library conta<strong>in</strong>s<br />

built-<strong>in</strong> support for locat<strong>in</strong>g <strong>the</strong> <strong>in</strong>terior<br />

corners of a chess-board calibration rig (e.g.<br />

f<strong>in</strong>dChessboardCorners). The set of pair<strong>in</strong>gs<br />

between raw depth values and object depths obta<strong>in</strong>ed<br />

this way does <strong>the</strong> calibration of raw depth<br />

values <strong>to</strong> meters.<br />

4. In <strong>the</strong> last step, I generated a yml calibration file,<br />

that can be used <strong>in</strong> applications (e.g. OpenCV).<br />

Open<strong>in</strong>g <strong>the</strong> viewer <strong>with</strong> this file I see <strong>the</strong> calibrated<br />

image: not dis<strong>to</strong>rted at <strong>the</strong> edges and <strong>the</strong><br />

distances are accurate (Fig. 3). The calibration<br />

file conta<strong>in</strong>:<br />

rgb-<strong>in</strong>tr<strong>in</strong>sics and depth-<strong>in</strong>tr<strong>in</strong>sics:<br />

<strong>the</strong> camera’s <strong>in</strong>tr<strong>in</strong>sic parameters <strong>in</strong> pixel<br />

units, a matrix <strong>with</strong> <strong>the</strong> pr<strong>in</strong>ciple po<strong>in</strong>t<br />

(usually <strong>the</strong> image center), c x,y and <strong>the</strong><br />

focal length, f 1,2<br />

Figure 3: Depth image results from <strong>the</strong> cameras calibration<br />

(left) me <strong>in</strong> my desk <strong>in</strong> a uncalibrated camera<br />

and (right) much happier and calibrated after.<br />

rgb-dis<strong>to</strong>rtion and depth-dis<strong>to</strong>rtion:<br />

lenses also have some dis<strong>to</strong>rtion (radial,<br />

k 1,2,3 , and tangential, P 1,2 ).<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!