top of page

Project Demo

We created a Matlab function to implement our most successful method. You can click the link below to download it. You will need:

Google Drive (Source Code and Data):

https://drive.google.com/drive/folders/0B8D5p8JjhurUZW13WjVTMjk1bnM?usp=sharing

​

GitHub (Source Code Only):

https://github.com/PDomanico/RoadImagery

​

- Matlab r2015a or newer (current students can install free via mathworks.com)

- A png image of a fairly detailed roadmap (see our examples), where you know the meters/pixel ratio

- A geotiff satellite image file. We recommend the USGS page we brought our data from (link on the References       page)

- Caution: since we are matching a satellite image to a map, the satellite image must be geographically smaller than the map.

​

Unzip everything to your active Matlab directory and open the readme for instructions.

​

If you want to see a quick run-though and/or do not have access to Matlab, we've created a step-by-step example of the demo below. Each step includes the related code, a short explanation, and any useful output.

Step 1: Load Images and Start the Program

This is the only part of the demo that requires user input. The demo is a Matlab function satDemo(satImg_file,map_file, sat_geo_sz,xplore). satImg_file is the satellite image geotiff filename, map_file is the filename of the .png map image, map_geo_sz is the meters/pixel ratio of the road map, and xplore is a keyword to either display or suppress visual output. xplore == 'visuals' to show output, and 'code' to suppress. All inputs are strings. 

​

After moving the satellite image file and satDemo.m and all of its helper functions into the active directory, we execute the following command t

​

> > A = satDemo('SF7.tif','SF.png',8.851,'visuals')

​

The demo is hands-off from this point. Since xplore == 'visuals', the demo displays output along the way to enumerate the procedure.

Step 2: Extract Information from the Images

In this step, we wish to convert our raw images into useful information for our algorithm. Both the satellite and map images are converted into RGB m x n x 3 matrices, and the satellite image's meter/pixel ratio is extracted from the .tif file. We also make copies of the unaltered images to be used later.

Step 3: Remove Complexity with a Color Filter

This step converts each image to a simplified, binary image (a pixel is either black or white) for further processing. From the maps and satellite images we studied, we created a threshold for each image that would primarily draw out roads. This functionality is hidden within the sat2BW and road2BW functions. They essentially set the target colors to be a white (gray or gray and orange in the map's case) and all other colors to appear as black. This results in the following images:

Step 4: Denoise the Satellite Image

Because the satellite image contains so much extra information that the map image does not, it will need to be processed further in order to match correctly with the map image. This algorithm uses two steps: median filtering, and large-object-filtering, or 'blob filtering.'

Median Filter

The median filter is designed to remove small, random noise. This could be either transition errors in the color filter or simply unexpected detail in the satellite image's landscape. The filter sets a target pixel to the median value of a surrounding 8 x 8-pixel area. Because we simplified to black and white only, this tends to get rid of 'out-of-place' pixels.

Step 5: Match the Images

Now the satellite image is filtered and looks approximately like the map. Our final step is to find the satellite image's match somewhere in the map. We do this in three steps: Resampling the satellite image, convolving the satellite image across the map to create a correlation matrix, and using that matrix to align the images.

Resampling (Up- or Downsampling)

This step is done to generalize to the case where the images are not the same size geographically, i.e. they have differnt meters/pixel ratios. We use Matlab function imresize to either up- or downsample the satellite image to match the map. You can se the results on our example image below:

Correlation

Luckily Matlab has a built-in matrix-optimized correlation function. c = normxcorr2.m accepts two images, one samller than the other, and returns a matrix where every cell contains the correlation coefficient for one possible image match. The actual match will theoretically be the cell with the largest correlation coefficient. That cell denotes the coordinates of the upper-left-hand corner of the satellite image in the map image. In our example, you can clearly see this maximum value on the surface graph of the 'c' matrix below:

Aligning the Images

Before we display the result, we ensure there will be no off-by-one error and that the match places the satellite image wholly in the map. Now it's time to check our work! We can see from the image below that the placement is correct:

The match even endures close inspection:

In any case the function returns the match location so that iterative tests can be performed. We discuss the conclusions of such testing in the 'Results' section.

bottom of page