Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Robotics Algorithm Anyone?
Message
De
09/01/2006 20:39:18
 
 
À
09/01/2006 09:44:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01082862
Message ID:
01085013
Vues:
42
Hi Simon. Sorry to barge in. I haven't followed your math through, but at one point you calculate DEGREES_PER_PX, which is not constant across the image (it's larger near the center).

In any case, you can calculate average DEGREES_PER_PX = MAX_HORIZ_ANGLE / MAX_HORIZ_PXS

Alex



>Hi Dragan,
>
>Hmm, something is not quite right. Can you see where I am going wrong? If I understand polar coordinates correctly, the Origin is the camera len, the Pole is the obstacle, and radius is the distance between the Origin and the Pole, and Theta is the angle joining the semi-infinate line L and the line joining the Origin to the Pole. (L is the x-axis line (left-right of the len).
>
>Here is my code below. The X and Y values don't look right at all! Should Y not be similar to the radius? and should X not be something like 1 cm?
>
>
>//
>// C# code
>//
>// The input data I am using has been obtained from the following picture
>// http://www.simoncragg.com/images/capture3.bmp.  Bascially the pole is a CD case
>// (only using horizontal widths and angles). The pole is 14 cms in actual width,
>// with a pixel width of 123px.  The pole is positioned approxiately 91cms from the
>// camera's len.  The distance in pixels between the center of the image and the center
>// of the pole is 27 pixels.
>
>const double MAX_HORZI_ANGLE = 45;
>const int MAX_HORIZ_PXS= 640;
>const double ACTUAL_POLE_WIDTH = 14;
>const double DEGREES_PER_PX = (Math.PI * 180) * (MAX_HORIZ_ANGLE / MAX_HORIZ_PXS);
>
>int polePxWidth = 123 // width of the pole in pixels
>double pxOffset = 27; // distance from center of pole and center of image (pixels)
>
>// Calculate the radius
>double angle = MAX_HORIZ_ANGLE / 180 * Math.PI * polePixelWidth / MAX_HORIZ_PXS;
>double radius = ACTUAL_POLE_WIDTH / Math.Tan(angle);
>
>// Calculate the R-Theta using the pixelOffset and distance.
>double theta = pixelOffset * DEGREES_PER_PX;
>double x = radius * Math.Cos(theta);
>double y = radius * Math.Sin(theta);
>
>
>results
>-------
>angle = 0.44914957469291572
>radius = 29.04524359178107
>x = 18.426107471523718
>y = -22.452276916913288
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform