Monday, May 30, 2011

Variance and Deviation for the Transformation

I checked the neighborhood of the arbitrarily chosen zero point for the graph paper and found a minimum for the sum of the variances of the horizontal and vertical lines through the zero point.

As expected the accuracy of the fit is limited by the accuracy in the determination of the data points. The nonlinearity of the pixel function makes it difficult to find the inverse function. But the transformation is one-to-one so one can still search for the graph paper coordinates which correspond to a given pixel point.

Curvilinear Perspective

The quadratic fit for the distorted graph paper grid in the photograph is an example of a nonlinear transformation. But the formula is linear with respect to the coefficients which allows one to do a least squares fit. When both λ and μ are zero, the pixel function tells us that it is equal to the arbitrarily chosen zero point. One can then do ordinary least squares curve fits for both the horizontal and vertical lines through the zero point. This gives all of the coefficients except for the last in the quadratic function. In yesterday's post I estimated the the last coefficient by averaging the directions of a set of lines and then trying to improve on this by trial and error. Today I learned that the last coefficient can also be found by a least squares fit which involves all the points of the grid. There was a small deviation from yesterday's result. Residuals would probably show that this is a better fit.

The general problem is that of Curvilinear Perspective which was studied by Renaissance artists. Curve fits might be useful for approximating the transformations involved if they are not known in advance.

Sunday, May 29, 2011

Photographic Distortion: A Complication

Using a camera to record the projected images of the Sun poses some problems. Pixel coordinates need to be converted into horizontal positions to accurately measure the Sun's altitude and azimuth. But, as the image below demonstrates, the results can be skewed by perspective.

A photograph of a sheet of graph paper can be used to determine the coordinates of a point on a horizontal plane. One can plot the pixel coordinates of points separated by unit distances in order to measure the amount of distortion present. In the example below the intersections of the bolder horizontal and vertical lines on the graph paper were plotted to produce a grid pattern. MS Paint proved to be a useful tool for obtaining the pixel coordinates. I chose west-east as the horizontal λ-axis and south-north as the vertical μ-axis. The graph paper was a sheet from TOPS Engineer's Computation Pad which has an inch as the unit of measure with five subdivisions.

The pixel points were used to fit horizontal and vertical quadratic curves through them which were used in turn used to find a quadratic function to represent the distorted plane in the image. The formula is given below.

Pixel coordinates, (x,y), are measured from the top left of an image which is (0,0). The first coordinate, x, is the number of pixels to the right and the second, y, is the number down. The columns of the matrix, P, are the coefficients of the quadratic function. In this case they happen to be vectors. The upper number corresponds to the pixel x-axis and the lower to the pixel y-axis. The fit isn't perfect. The pixel numbers introduce round off errors and the pictures themselves are stored in a compressed format which adds an additional complication for reading positions. And the fit was only quadratic.

The lower left corner of the grid was arbitrarily chosen to correspond to λ = 0 and μ = 0.

You can compare the pixel coordinates from the fit with those from the image using Paint. One needs to activate the selection tool and position the cursor over a pixel in the image. The coordinates can be read at the bottom of the screen. To see an image in this blog in its original size just click on it and the image should open on a new web page. You can then download the original image for the comparison.

Edit (30 May 2011): I rotated the image while doing the fit to make λ horizontal and as a result the pixel x,y values ended up being transposed.

Friday, May 20, 2011

Local Noon and the Hour Angle

On Thursday I made an attempt at determining local noon using the setup below. The aperature of the lens was increased to about 6mm using a hole punch for better contrast. NIO captured projected images of the Sun at approximately 5 minute intervals over roughly a two hour period.

The motion of the camera complicated comparing the data somewhat. Fortunately I had drawn a reference line of the plywood board used as a platform. The two ends of the lines and one corner of the board served as reference points to realign the data from the images. The first step was to translate all the x,y pixel coordinates so that the west side of the lines were at the same coordinates. Then the image data was resized so the distance along the line was the same for all the images. The data was then rotated to give the east ends of the lines the same direction. The result of this realignment was that the greatest amount of error was in the location of the corner and the average value was 1.37 pixels. This proved to be equivalent to an angular resolution of 2.63 minutes of arc.

Determing the time of local noon proved to be more challenging. At local noon the Sun is highest in the sky and as a result distance of its projected image from the point directly beneath the lens aperature will be a minimum. Although the images only determine directions relative to the camera the angular distances contained enough information to make an estimate of local noon. A rough polynomial fit was used to determine the approximate time of local noon. The coefficients of the smaller powers of this fit turned out to be zero. So a second polynomial fit using the difference in time between the time of the observation and the first estimate of local noon resulted in a simpler polynomial. The final fit turned out to be surprisingly accurate. The rms error in pixel position was 0.262 which corresponds to 0.505 minutes of arc. The result was a reasonably good estimate of the local time. The difference between mean solar time and local solar time was 5.226 minutes. MICA indicated that value for the Equation of Time was 3m 32.2s or 3.537 minutes. The difference, 1.689 minutes, is due to the difference in longitude from the prime meridian for the time zone. Each minute of time corresponds to 0.25 degrees so the time difference corresponds to a difference in longitude from the time zone's meridian of 0.422 degrees. This difference allows one to determine the hour angle or the number of degrees from the prime meridian of Greenwich.

I compared the estimated longitude with the longitude found in Google Earth and their ruler tool indicated that the difference was about 21 km*.

* Edit: The original estimate was too small. The distance is approximately
   R cos(lat) Δlong where R is the equatorial radius of the Earth.

   I started taking pictures shortly before local noon so my data was rather one-sided. A two hour interval centered near local noon would probably give better results.

Wednesday, May 18, 2011

Measuring the Sun's Altitude with an Objective Lens

I tried a simple way to measure the Sun's altitude this afternoon by mounting the objective lens of a small telescope on a tripod. The 50mm lens and holder come from a Jason Star Search Telescope 100. It was held in place by a small Phillips head screw which is easy to remove. The shade on the end of telescope just slides off.

An image of the Sun was projected onto a 8 1/2 x 11 inch sheet of paper lying on the ground near the focal length of the lens. You can see the index card which was used to stop down the lens. By placing a watch in the image one can keep track of the time. The time on the watch needed resetting but this was just a test of the method. To find the correct time you can go the Official US Time page at NIST or use their widget on the sidebar to the right. Both clocks can be adjusted to display the time in US Time Zones or UTC.

The image seen above is a little blurred by internal reflections in the lens but changing the angle the lens helps. This method works better than with the lens on the telescope since it allows the image of the Sun to move freely across the screen as the time changes.