Appendix E - Image Processing

8
E-1 Appendix E: Area calculations with image processing In order to estimate areas one technique that was developed during the course of this project was the use of image processing with Matlab. Today satellite photos are easily accessible to the public with programs like Google earth and Google maps as shown in Figure E1. By saving these images it is possible to calculate the drainage area of a basin. Figure E1 A digital image is really a three dimensional matrix of numbers. Each pixel is assigned a specific color based on the number values assigned to its location in the matrix. Each pixel can be one of more then 16 million colors. Each pixel is broken up into three colors: red, green, and blue as shown in Figure E2.

description

Image processing with Computer Tools

Transcript of Appendix E - Image Processing

  • E-1

    Appendix E: Area calculations with image processing

    In order to estimate areas one technique that was developed during the course of this project was the use of image processing with Matlab. Today satellite photos are easily accessible to the public with programs like Google earth and Google maps as shown in Figure E1. By saving these images it is possible to calculate the drainage area of a basin.

    Figure E1

    A digital image is really a three dimensional matrix of numbers. Each pixel is assigned a specific color based on the number values assigned to its location in the matrix. Each pixel can be one of more then 16 million colors. Each pixel is broken up into three colors: red, green, and blue as shown in Figure E2.

  • E-2

    Figure E2

    One could think of it as three spread sheets on top of each other. The first one has all the numerical values for the red level of the pixel. The second spread sheet has all the green values of the pixel, and the third blue. These spread sheets are saved into each photo file and are called layers or channels. With the use of photo editing software such as Microsoft Paint or Adobe Photoshop the original image (Figure E1) can be cropped to the drainage area from our basin. This is Figure E3, where only pixels in our drainage area are included. This area was figured out from topographic data and storm drain layout. Computing the color levels with Matlab is the graph in Figure E3. The on the X axis lighters pixels are to the right and black is to the left. The amount of pixels that are at the specific light/dark level are plotted on the Y axis. Once the image has been cropped and the only pixels in the image are in the basin the drainage area can be estimated.

    Figure E3

  • E-3

    Method 1: Target Colors

    By using Figure E1 and zooming into the road surface the color levels can analyzed as shown in Figure E4. The pixel colors associated with the road surface can be set as the target colors. Figure E4 was taken from the intersection of Amwell rd. and Wescott rd. The graph of Figure E4 shoes that that grays of the road surface fall in the middle of the graph and have two distinct peaks.

    Figure E4

    By searching the drainage area from Figure E3 and selective filtering out the target colors one could get an estimate of the physical area of the drainage area that is natural, and the area that contains the target colors (roads and roofs). This target color also represents the impenetrable area of the drainage, and one could also think of it as separating the pixels by their albedo. By replacing the pixels that fall under the target colors with white Figure E5 is generated.

    Figure E5

  • E-4

    It works fairly well except in the forest area where the shadow of a tree can fall can display the target color. The results from this calculation are shown in Table E1, where the scale was set by the original image (Figure E1). The distance across Figure E1 can be measured in feet with Google Earth; this can be divided by the pixel width of the image. This results in the units of feet/pixel, which can then be used to solve for areas of the image.

    Table E1

    Target Colors Method

    % Natural 63.525%

    Area Natural (ft2) 813,495.45

    Area Paved (ft2) 467,095.93

    Unfortunately, because of the noise from the forest this is a very rough estimate.

    Method 2: Natural Ratio

    When examining each of the color layer independently as shown in Figure E6 something can be observed (note: Matlab flips the images when executing these graphing functions, so the images are up side down). The red and green channels of plant material are about the same, while the blue channel is slightly less. This represents the plants absorbing more blue light. Meanwhile the paved surfaced reflect more blue light then red or green. This pattern also is applied with Matlab to create another filter for determining if the pixel is paved or now. The criteria used is: If

    layer blue in thequestion in pixel theof valuenumerical theis layergreen in thequestion in pixel theof valuenumerical theis

    layer red in thequestion in pixel theof valuenumerical theis 101515

    BGR

    BRGRGR

    ++

    Then the pixel is considered a picture of a plant and therefore, pervious. This criterion is the natural ratio of a plant.

  • E-5

    Figure E6

    When applying the criteria to the whole image and displaying the results this represents Figure E7. In the image on the left the natural are is shown and the impermeable not natural area is colored with false color white. The image on the right of Figure E7 shows only the pixels that do not follow the natural ratio.

    Figure E7

  • E-6

    It can bee seen that the image on the left in Figure E7 is almost all the grass and trees of the drainage area. While the right half of Figure E7 is mostly the roads and roofs of the drainage area. The error associated with this Natural Ratio Method is much lower then the Target Colors Method. The errors of the tree shadows in the forest are gone. However some errors still remain in the detention basins grass area. The results generated with this method are presented in Table A2.

    Table A2

    Natural Ratio Method

    % Natural 74.769%

    Area Natural (ft2) 956,896.01

    Area Paved (ft2) 322,905.24

    A direct comparison of the methods is shown in Figure E8.

  • E-7

    Figure E8

    In figure the blue dots are the places where method 1 considered to be paved, the red dots are the places where method 2 considered not natural, and the white area is where they agree. Both methods seem to have some difficulty determining the pervious around each of the houses. This could be because the variations in colors around a house (from flowers, swing sets, and landscaping) can be very large when compared to a field, forest, and a road. Higher resolution starting image could help this problem. Overall the Natural Ratio Method seems to have much less occurrences of error pixels. For this reason it is the preferred method for calculation of pervious and impervious areas from satellite images.

    The comparison of the Natural Ratio Method to measurements taken from Google Earth ruler tool is shown in Table A3.

    Table A3

    Paved Area (ft^2) Figure E9 Figure E10

    Calculated with Natural Ratio Method

    33,089.00

    15,270.00

  • E-8

    Calculated with Google Maps

    27,310.57

    13,152.09 % Diff 21% 16%

    Figure E9 Figure E10

    Computed and actual areas were compared for sections of Amwell Road shown in Figure E9 and Figure E10. The Natural Ratio method produced area results that were 16% - 21% above what the Google measurement tool measured. A section of road was used because it is easy to figure out the area of a road. Also the Natural Ratio method was used because it is the better method when compared to the Target Color method. Approximately the same difference in results can be applied to the results calculated for the whole image. For the Natural Ratio method the total paved are was calculated to be 322,905.24 ft^2 for the drainage area, this can be assumed to be about 25% larger than the actual value. Knowing this could help with determining the size of the safety factor to use. Again, the advantages of the image processing techniques addressed in this appendix are for instantaneous estimation of area with a computer, and where calculation by hand is difficult because of difficult paved shapes such as pools. In the end if the entire paved area was calculated with Google measurement tool it is likely there would be much high error then the methods presented for image processing, along with significantly more time needed.

    The resolutions of these techniques are directly related to the resolution of the original image. The more pixels in the area of the drainage area the higher the accuracy will be. This technique can also be applied to larger scale images if the areas were computed in small sections and reassembled. This would allow for higher resolution for a larger area.