Above are two images of the same object at slightly different perspectives (The object was moved to the right by 15cm).
My code:
f = 6; //focus
b = 150;
M1 = imread('C:\Documents and Settings\AP186user20\Desktop\august12_2008\Cube1.jpg');
M2 = imread('C:\Documents and Settings\AP186user20\Desktop\august12_2008\Cube2.jpg');
M1 = im2gray(M1);
M2 = im2gray(M2);
imshow(M1,[]);
M2 = im2gray(M2);
imshow(M1,[]);
x1 = locate(10,1);
imshow(M2,[]);
x2 = locate(10,1);
z = b*f/(x2(1,:) - x1(1,:));
nx = 40;
ny = 40;
x = linspace(1,1,nx);
y = linspace(1,1,ny);
[XP,YP] = ndgrid(x,y);
ZP = interp2d(XP, YP, x1(1,:), x1(2,:), splin2d(x1(1,:), x1(2,:), z, "natural"));
//plot(x2(1,:),x2(:,1), z);
mesh(ZP)
SELF-GRADE: 6/10, hindi ko pa yari
Thanks to Beth for pictures, Rica and Aiyin for storage
No comments:
Post a Comment