14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

124 Appendix B. Documentation <strong>of</strong> <strong>the</strong> programming<br />

position=inv(K)∗image point ;<br />

l=sqrt(xˆ2+yˆ2);<br />

%l <strong>the</strong> distance <strong>of</strong> <strong>the</strong> origin point selected in <strong>the</strong> image to <strong>the</strong> robot<br />

%% center<br />

Dreal=200; %diameter <strong>of</strong> <strong>the</strong> ball in mm<br />

Dpx=29; %pixel counter <strong>of</strong> diameter in image<br />

%<strong>the</strong> f∗ constant pixel/unit (mm)<br />

fstar = Dpx ∗ l / Dreal ;<br />

%<strong>the</strong> position should be normalized since position (3) is not 1<br />

position= position/norm( position );<br />

Pc=[( fstar∗Dreal/Dpx)∗ position ;1];<br />

inv(T cw∗T rw)∗Pc;<br />

result= T wr∗T wc∗Pc;<br />

result<br />

%ans gives <strong>the</strong> position <strong>of</strong> <strong>the</strong> ball in real world in mm<br />

% ans(1) x;ans(2) y;ans(3) z ; coordinates in real world<br />

%% 2−) Calibration for <strong>the</strong> object at Ground<br />

%tranlastion matrix−coming from image toolbox<br />

Tc ext = [ 160.700069 27.498986 492.532634 ];<br />

%rotation matrix−coming from image toolbox<br />

Rc ext = [ −0.009783 −0.999883 −0.011800<br />

−0.428525 0.014854 −0.903408<br />

0.903477 −0.003781 −0.428620 ];<br />

%transformation <strong>of</strong> camera to chess board<br />

T cch=[Rc ext Tc ext ’];<br />

% K internal camera parameters−from image toolbox<br />

K=[191.71462 0 80.35911<br />

0 191.27299 61.27650<br />

0 0 1 ];<br />

% x,y,z <strong>the</strong> distance <strong>of</strong> <strong>the</strong> chess board from <strong>the</strong> robots center in mm.<br />

x=550;

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

Saved successfully!

Ooh no, something went wrong!