I’m trying to figure out a way to more rapidly determine where new construction is happening by comparing annual satellite imagery.
In Google Earth, you can roll back the clock on satellite imagery, for whatever reason, and determine what has changed over the years. One thing thats interesting is you can determine new construction. Currently, I’m doing it manually which is very slow.
I know satellite photos can vary greatly due to weather, photo exposure variations, seasonal changes, etcetera so my plan is to run some photoshop filters on satellite photos to try and normalize the imagery, then run some kind of “diff” process to highlight where changes have occurred.
Here’s an example of two satellite photos, the first taken in May 2013, the other taken in January 2015.
It would be really neat if I could run some process that would highlight the areas that have changed dramatically, such that the new houses, in this case, would be easily identifiable. Maybe the output would look something like this on the more recent (2015) photo….
OK, obviously it wouldn’t look like that, but I think the last image outlines my purpose here.
Thanks
4
Answers
Yes, such tools are available. For example, you can use the comparel method in ImageMagick to compare two images. It isn’t a visual diff tool per se, but rather a library upon which you can build your own tool. It has an incredible array of options for highlighting differences.
Unfortunately the lighting on the two images you have is vastly different. On the May 2013 image it is near midday and the sun is directly overhead meaning there are no shadows – as such, the houses that were standing then are virtually indistinguishable from the surrounding ground. On the January 2015 image the lighting is from the bottom of the image and the shadows are harsh. As such, any differencing you do is not going to detect the changes in the number of houses, but rather the changes in the lighting are going to dominate.
There is a tool called
flicker_compare
on theImageMagick
website that can rapidly flick between images that may help you do the differencing manually. I used it like this:Sorry, I have no other suggestions.
Check out git-diff-image. An extension to ‘git diff’ that provides support for diffing images. It can also be run as a direct CLI command for diffing two image files.
I have spent a little bit too much time on this so I think it is worth to share my experience. git-diff-image was my inspiration to write minimal and faster image diffing tool.
So first you need to set supported image types in .gitattributes files like this:
This can be done in root but then specify this in your root git config file like this:
Then you need to specify diff command for images like this (in git config file):
As well I have created diff-image alias:
Now for image diffing you can use odiff or pixelmatch (I prefer odiff because of its output). Install globally using npm:
Lastly you need to write image-diff.sh:
Now you can use "git diff-image" to see visual diffs.