Google Earth Image Overlay geo-referencing algorithm

Source: Internet
Author: User
Tags in degrees

In Google Earth, a picture can be added as a "overlay" (menu: Add-and-image overlay), by panning, rotating, stretching, and so on, so that the geographic features on the picture coincide with the satellite images in Google Earth. This process is called the geo-referencing of the image, that is, the mapping between the pixel space of the image (in pixels, column coordinates) and the geographic space (in latitude and longitude).

Take Shenzhen Baoan District Green Road Map (address: http://imgbdb2.bendibao.com/szbdb/20143/20/201432014584100.jpg) as an example. Add the map as a picture overlay, select 3 large points of interest on the map, pan, rotate, stretch, and so on, so that the 3 points of interest coincide with the actual location on the satellite map. Such as:

The 3 points of interest selected are:

    • Guangtianlu and Yanshan Avenue intersection, Pixel coordinates (995, 288), geographical coordinates are (113.852873, 22.806881)
    • Baoan Avenue and Xinan Five intersection point, pixel coordinates (1136, 2318), geographical coordinates are (113.875381, 22.57191)
    • The high-speed intersection of the long and high-speed machines with a pixel coordinate of (1904, 1339) with geographical coordinates (113.969075, 22.686780).

In the above pixel coordinates (x, y), X, y are the columns and rows of pixels respectively, the origin is in the upper left corner of the image, the x, y in geographical coordinates (x, y) are longitude and dimension respectively, longitude is positive in east, and dimension northward is positive. After the same.

Google Earth allows the operation of the image overlay to be translated (Translate), rotation (Rotate), stretching (scale) 3, in addition, because the pixel coordinate y-axis direction is opposite to the geographic coordinate y axis (latitude), This implies a reflection transformation (Reflect) relative to the x-axis. Therefore, the geo-referencing of the image overlay is a 2D profiling transformation. The so-called affine transformation, has such characteristics: line transformation is still a straight line, parallel lines after the transformation is still parallel, and then parallelogram transformation is still parallelogram.

As a test, after the above "3-point positioning" process, the map of other geographical features (such as: road) and satellite images were compared, found that the high degree of compliance. Thus we conclude that the image overlay of Google Earth is a 2D affine transformation of the image's pixel space to the geographic space.

1, the transformation matrix from pixel space to geographic space

In computer graphics, the formula for 2D affine transformation is:

where (x, y) is the coordinate before the transformation, (x ', y ') is the transformed coordinate, and the 3x3 matrix is the transformation matrix. Notice that the 3rd behavior constant of the transformation matrix.

To solve the transformation matrix, we only need to solve 6 unknowns M11, M12 、... M23. If the coordinates of the 3 pairs of transformation points are known, the equations of 6 linear equations will be obtained, and the transformation matrix can be obtained by solving the equation set. This is why you need to locate 3 points when you add a picture overlay earlier.

Once you have obtained a transformation matrix from pixel space to geospatial, you can calculate the geographic coordinates (latitude and longitude) of the point (pixel) of the image.

2, another method to solve the transformation matrix from pixel space to geographic space

If you export the picture overlay in Google Earth as KML (select the image overlay in the location panel, and then click menu: Save As, file-so), check the contents of the KML file as follows:

1         <Groundoverlay>2             <name>Untitled Image Overlay</name>3             <Icon>4                 <href>Http://imgbdb2.bendibao.com/szbdb/20143/20/201432014584100.jpg</href>5                 <Viewboundscale>0.75</Viewboundscale>6             </Icon>7             <Latlonbox>8                 < North>22.84065998787623</ North>9                 < South>22.54036701934297</ South>Ten                 <East>113.9954174014041</East> One                 <West>113.7305967071939</West> A                 <Rotation>1.042495828443866</Rotation> -             </Latlonbox> -         </Groundoverlay>

The rectangle bounding box for the picture overlay is defined according to the KML file specification,<latlonbox>, where <rotation> defines the rotation angle relative to the center point of the bounding box, in degrees counterclockwise. The transformation matrix can also be computed based on the KML bounding box definition (including the rotation angle).

We decompose the entire process into the following "Basic transformations":

(1) Zoom

Initially, the image coordinate system coincides with the geographic coordinate system and the image width is W and the height is H. Zooms the image to the size of the kml bounding box, where the width is e-w, the height is n-S, where E is the right longitude (east) of the bounding box, W is the left longitude (west), n is the upper latitude (north), S is the lower latitude (south), and the back is the same.

The transformation matrix for scaling is:

(2) Panning

Move the image center to the origin, and the transformation matrix is:

(3) Reflection

Because the y-axis direction of the pixel space is opposite to the y-axis of the geographic coordinate system, you need to reflect the image relative to the x-axis, whose transformation matrix is:

(4) Rotation

Rotate the angle in a counterclockwise direction around the origin, and the transformation matrix is:

(5) Panning

To move the origin to the center of the kml bounding box, the transformation matrix is:

Finally, the transformation matrix from pixel space to geospatial space is m=m5*m4*m3*m2*m1.

Once you have the transformation matrix from pixel space to geospatial, you can position the geographic location (latitude and longitude) to the pixels on the picture.

3, transformation matrix from geographic space to pixel space

The transformation from geographic space to pixel space is the inverse of transformation from pixel space to geographic space. The inverse of the affine transformation is also the affine transformation, and the transformation matrices of the two are inverse matrices. To calculate the transformation matrix from geospatial to pixel space, you can use the method of solving a linear equation set as described in section 1th above. If the transformation matrix from pixel space to geographic space is known, the inverse matrix can be directly obtained, for example, by using feature decomposition.

Google Earth Image Overlay geo-referencing algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.