Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Robotics Algorithm Anyone?
Message
De
04/01/2006 12:28:22
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
04/01/2006 08:28:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01082862
Message ID:
01083202
Vues:
34
>Hi Dragan
>
>Many thanks for your reply.
>
>Another question or two if I may!
>
>1) How do you know the total angle of your camera? Is this sort of thing in the manual?

Sometimes. I've seen it in the manuals for some cameras, ages ago. But you can pretty much do some tests - measure the angle between your camera and two known physical objects, and the measure the number of pixels between these two objects on the image. Do this a dozen times and get the average pixels/degree for your camera. Try to spread these objects as wide as possible, to minimize the roundoff errors.

>2) When the obstacle is a square (or I suppose a sphere) do I need to concern myself with the total vertical angle? (i.e. is the total horizontal angle not sufficient?)

I proposed the vertical angle just as an additional measure, which would decrease the roundoff error. The farther your object, the fewer pixels it will take, and when its pixel size goes down to double or single digits, one pixel more or less may significantly throw the calculation off. That's why I'd recommend taking the average between the vertical and horizontal pixel size. You'll need all the precision you can get.

>For example:-
>
>       nMaxPx=1280
>       nPx=17
>       nWidth=1.25
>       nMaxAngle=88
>
>       nAngle=nMaxAngle/180*pi()*nPx/nMaxPx
>       nDistance=nWidth/tan(nAngle)
>
>
>3) Are you aware of a link that gives more details of this algorithm?

Can't post a link to a piece of paper where I have drawn the triangle and wrote h/d=tan(phi) :). Note that I wrote atan() in the example above, which was wrong - it should be tan().

I'm a mathematician; the above was simple.

>4) Would you be able to parenthesise the expressions above to establish correct operator precedence?

No need for that - multiplication and division are the same. You may precalculate the part which is not changing, though:
       nConst=pi()/(180*nMaxPx)
       nAngle=nMaxAngle*nPx*nConst
       nDistance=nWidth/tan(nAngle)
>
The max angle, nMaxPix are not variable - they are the properties of your camera, and there's no way pi() would ever change in this universe. So you may as well calculate this only once, in the constructor of your class.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform