// // 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