cpet-563-01l3-coursework/realLab1.m

22 lines
411 B
Matlab

b = 60;
f = 6;
ps = 0.006;
xNumPix = 752;
cxLeft = xNumPix/2;
cxRight = xNumPix/2;
shift = 10;
xLeft = cxLeft + shift;
xRight = cxRight - 10;
d = (abs((xLeft-cxLeft)-(xRight-cxRight))*ps);
Z = (b * f)/d;
unitConversion = Z / 1000; %Z is calculated in millimeters, according to lab handout.
hold on
plot(shift,Z,'x')
xlabel("disparity [pixels]")
ylabel("depth [m]")
xlim([0 300])
title("Depth vs Disparity")