MATLAB: Getting x and y for 3d

image processingstar warswebcam

1.how can i obtain real world X and Y from x and y obtained from an image? 2.is scaling factor in x dirn*x=X and scaling factor in y dirn*y=Y ? if then how could i find the scaling factors?

Best Answer

A=yourPicture;
[H L]=size(A);
dx=theRealLengthOfTheView/H; %this you must know, otherwise you can not scale the image.
dy=theRealWidthOfTheView/L;
figure(1);imagesc(A);
h=impoint;
[y x] = getPosition(h);
X=dx*x;
Y=dy*y;
Where your X and Y will be the real world distances from the origin (0,0) at the top left corner of the picture.