# Thread: Computing Box Dimensions using relative object

1. ## Computing Box Dimensions using relative object

Hi every one, im actually new in image processing, i want to make an algorithm im Matlab which allows me to get the dimensions of the box out of image using a relative object so with knowing the length of that object i get all dimensions of the box. how do you think its possible to do this? i would appropriate your cooperation in advance

2. ## Re: Computing Box Dimensions using relative object

Disclaimer: I don't know the answer. But I know how I would figure it out. One problem you have is that you have to know relatively how far away the box and the object are. Otherwise the box could be twice as big and twice as far away and the picture would look exactly the same (I'm discounting DoF effects.)

You're trying to back out 3-dimensional data from a 2-dimensional projection, which is ordinarily impossible. Fortunately, you have the extra information that the box is rectangular. I'd use a symbolic manipulator (Mathematica, Maple, or their ilk) and work out the formulas for the projection of the corners of an arbitrarily rotated box. Yes, this is doable by hand, but I've gotten lazy and computers are powerful. Then solve for the original box dimensions given the positions of the visible corners in your photograph. There will be a single undetermined scale factor that you'll have to get from the object (see the paragraph above), but that's the easy part.

Good luck, and have fun!

Matt