Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Robotics Algorithm Anyone?
Message
De
05/01/2006 17:28:01
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
05/01/2006 08:37:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01082862
Message ID:
01083828
Vues:
32
>Hi Dragan,
>
>Thanks again for another excellent reply.
>
>I have successfully implemented a C# program using this algorithm. The program uses 3 test photos. The first image contains a single obstacle which is positioned centrally at a distance of 30cms. The second is positioned at 60cms and the third at 90cms. I had to play around with the camera angle and found that 45 degrees gives me near 100% accuracy which I suppose is correct as I am currently using a 3G phone?
>
>Do you know how to approximate the angle of the obstacle from the camera? This data would enable me to create a 2D (birds-eye-view) local map for the robot. I am guessing that the algorithm would require some existing arguments and perhaps the coordinates of the obstacle's centre point? (I can work out these coordinates)

The angle under which the obstacle is seen from the camera? That's the nAngle in the code I had here.

If you'd need the angle for polar coordinates (or R-theta, as someone called it here), you'd need the number of pixels from the center of image to the center of the obstacle (90o if this number is zero, more than 90 to the left, less than 90 to the right - basically your theta=0 to the right of the camera, 180 to the left). Just multiply this number of pixels with your degrees-per-pixel ratio and there you are.

Then you'd need to convert the polar coordinates to Cartesian:

x=r*cos(theta)
y=r*sin(theta)

where x is your left-right coordinate, and y is your forth-back one. Note that theta needs to be expressed in radians (i.e. already multiplied with pi()/180), unless your compiler has a setting somewhere to do that for you. Most programming languages use radians, which are the natural unit of measure (and so does Fox, BTW).

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