Tuesday, August 2, 2022

Crash Course on Handling Satellite Images

 

Crash Course on Handling Satellite Images

Or: “Why are my pictures so ugly?” by Tim Ehrhart (@artisinalAPT)



You’ve seen the pictures on the news or twitter and have been dying to get your own satellite imagery, right? Making serious products requires training but if you just want to get started creating images for your own research, it’s not that hard to get the basics down. This post will help you learn how to purchase and use archived images from popular satellite providers.


Satellite imagery companies can provide imagery in a number of formats. For commercial users the two most common are JPEG2000 (a.k.a. JP2, JP2K) and GeoTIFF (e.g. .tif, .tiff, .geotiff). These are similar to a photograph you may be used to, but have a few key differences:


  • These images contain geospatial reference data. This helps software identify the location of each pixel on the planet.

  • These images can often have much larger color value ranges - both in each channel and the number of channels.

  • Unlike traditional photographs that have 3 bands (red, green, blue), satellite imagery normally comes with at least 4, and sometimes up to 8 different bands/channels, delivered as layers. These typically include a red, green, blue and various infrared channels in different ranges.

  • These images can be very large. Full scene images (the whole picture taken by the spacecraft) can often be 2+ GB in size.



Learn what’s available and what you need

There’s a lot of different types of satellite data available. If you’re reading this, we’ll assume you’re not looking for anything fancy. Here are the most common types of imagery sensor data you’ll probably look at:


Electro Optical (EO) - The picture most everyone is looking for. As mentioned in the introduction, EO imagery can go outside the visible spectrum, but you can use just the visible range to generate images that are basically a photo from space. The advantage of the infrared spectrum is that you can sense interesting things. For example, you can find active fires, detect areas that have been burned, detect moisture, and even tell the difference between green trees and a green military vehicle based on the IR signature.


Synthetic Aperture Radar (SAR) - SAR is becoming more commonplace outside of defense use. It’s commonly used to build digital elevation models (a 3D map) of terrain. It’s also especially useful in imaging areas with heavy cloud or fog cover, as SAR can penetrate and “see” underneath in all weather conditions. SAR is a little odd to look at, and it can be hard to understand, but with Sentinel-1 offering free low-resolution SAR there’s a very good reason to at least try it when looking for large objects (e.g counting the number of IL76 aircraft at an airbase, finding if a pontoon bridge is in place)


It’s also important to understand the tradeoffs of resolution, coverage, and price. Generally, the higher resolution (sharper) a picture is, the more expensive it is and the smaller the area that will be covered. Conversely, the lower resolution systems will be cheaper (and even free) and cover much larger areas more frequently.



Name

Best Source

m/px

EUR/km2

Comment

Sentinel-1

SentinelHub

30.0

0.00

SAR

Sentinel-2

SentinelHub

10.0

0.00


Planet SuperDove

Skywatch.com

3.0

2.50

Nearly daily coverage of the entire land surface

Airbus SPOT

SentinelHub

1.5

0.70

Great value for looking over large areas with reasonable cost

TripleSat

Skywatch.com

0.8

10.00

Often takes days to provide an image

Satellogic


0.7



Airbus Pleiades

SentinelHub

0.5

8.00


Planet SkySat

Skywatch.com

0.5

10.00


Maxar Worldview

SentinelHub

0.5

16.50

Downsampled from 0.3m. Minimum order of 5km2 (€82.50)

Airbus Pleiades Neo

UP42.com

0.3

18.00

Never successfully ordered Neo from here

Airbus Pleiades Neo

Skywatch.com

0.3

20.00

Often takes days to provide an image


Imagery Examples

Here’s some sample imagery of a street in Bucha, Ukraine in March 2022 to compare the kinds of things visible at different resolutions, when compared to the same scale (1:500).


150cm

70cm

50cm

30cm




Get the data

Satellite imagery used to be available only to governments and large companies. Today anyone with a credit card can get up to 30cm/pixel imagery online for a low cost, and 10m/pixel imagery for free. Below are some popular platforms for getting satellite imagery.


SentinelHub - https://www.sentinel-hub.com/

This is one of the most popular platforms, as much of the data is available for free. Even if you don’t have a budget, SentinelHub will provide you access to imagery from public data sources such as ESA’s Sentinel missions and NASA’s Landsat missions. SentinelHub offers easy export into different formats (e.g. JPEG, PNG) including geospatial formats like GeoTIFF which can be used in other tools.


You can also purchase commercial imagery from SentinelHub, including Airbus Pleiades (0.5m), Airbus SPOT (1.5m), and Maxar (0.5m). You can order Planet SuperDove imagery here too, but only for area monitoring. You’ll need to pre-purchase credits for the different kinds of imagery you want to buy. SentinelHub also offers discounts when purchasing large amounts of Airbus imagery.


Finally, SentinelHub has a large number of datasets and processing scripts for different scenarios. For example, searching for data under the Wildfires theme in Sentinel hub will allow you to switch between normal and “wildfire” views of Sentinel-2 imagery.


Normal view

Wildfires view


For people monitoring damage after natural disasters or war, this can be a powerful and intuitive way to search for fires across large spaces. Be aware that this tool relies on data from the infrared band and does have false positives from things like reflections of windows, white surfaces, etc.


SkyWatch - https://skywatch.com/earthcache/

Skywatch is a reseller of satellite imagery from a variety of companies. It has a very straight-forward pricing model where all images of a certain class have a specific cost per square kilometer. 


Medium Resolution (1.5 - 8m):         $2.50

High Resolution (50cm - 1m):         $10.00

Very High Resolution (15cm - 49cm): $20.00


Purchasing imagery is very easy. Draw a box or polygon on the map, select the class of image you want and a date range, and press search. You can preview the images to make sure they’re not cloud covered and can click purchase. You create a “pipeline” to buy the imagery. You can select a single purchase, or a recurring purchase (e.g. daily). You also select the type of output. Normally I recommend “All optical bands”, to ensure you get all the available data for the imagery. However, if you just want to keep it simple you can get a RGB-type image returned here. 


You are billed for all purchases at the end of the month, and since it’s so easy to purchase imagery here, be aware that you might end up with a surprise if you’re not careful.


UP42 - https://up42.com

UP42 is an Airbus subsidiary. What sets them apart is that you can also use existing analytics on imagery and can even use analytics on images you don’t buy. For example, you can have a vehicle detection model run on every Pleiades image taken at a location, so you can count the number and location of all vehicles. You pay for the analytics and a small imagery fee, but you don’t have to buy the full image which could be costly.



Once you’ve signed up for a few platforms, I’ve created a small tool to let you search more quickly across multiple platforms here:

https://github.com/tehrhart/scratchpad/blob/master/Sat_Coverage_Finder.ipynb


You just need your API keys for Sentinel Hub and/or Skywatch and you can easily find the best coverage for the targets of interest. You can even run it from Google Colab - No computer needed!

https://colab.research.google.com/github/tehrhart/scratchpad/blob/master/Sat_Coverage_Finder.ipynb



Get the tools

While you may be able to open a JP2 or GeoTIFF image in a normal photo application, it’s likely to look really weird, or even completely black. There are lots of tools available but the best free, open-source tool available for handling this kind of imagery is qGIS.

https://www.qgis.org/en/site/


Download and install the software before continuing.


Opening these images in QGIS is like any other tool: images can be imported by the open menu, double-clicked in a folder, or dragged into the tool. An important consideration is that you can import multiple layers into the same workspace, so you can compare things over time or just different kinds of imagery. This is especially important to remember when dealing with split panchromatic and multispectral images that we’ll discuss later.



Crazy Contrast

The first challenge you’ll notice when you get your first raw images is that if you open them in a normal photo editing tool that they’re either black or almost entirely black, with no color or features visible. In these images you’ll need to do some work to reveal the color and details.


QGIS, thankfully, will automatically load multispectral imagery in a way that removes the top and bottom 2% of the pixel extremes from each band.


Entire range displayed (min-max)


Top/bottom 2% of range removed

(QGIS default)


You can see how much of a difference this makes. Unfortunately, it also allows some areas to be over exposed. You’ll have to play with your QGIS settings to get this just right, but in many images I set the cumulative count values to 0% and 99.95% or similar.


Can’t see the Layer Styling toolbox? Just use the menu options View > Panels > Layer Styling to show it. You’ll see it when selecting a layer and it applies only to the layer you currently have selected.


Crazy Colors

If your image shows a lot of really odd colors - like blue and yellow roofs when that’s not typical, try switching the red and blue color bands (typically bands 1 and 3). Different providers and processing lines seem to swap these bands, causing unusual color effects that are easily fixed in the layer styling box of QGIS.


RGB with Bands 1, 2, and 3.

Swapping bands 1 and 3


North Not Up

Most of us are used to seeing satellite imagery from Google Earth. This kind of imagery tends to be looking straight down to allow accurate locations and consistent perspective, and typically has north at the top of the image. This is normally how mapping imagers is made. However, many images are taken at more oblique angles which can contain much more information about the objects seen. Imagine how much information you can tell about a building by looking directly down at its roof versus looking at it from a 45° angle in the distance.


When dealing with images at an angle, it’s important that we rotate the images so that “up” is more natural to us. In QGIS you’ll find a rotation option in the bottom of the window. In report mode you’ll find the rotation as a property of the map you’ve selected.


To find a better rotation, try to find a tall vertical object: telephone pole, antenna, or the edge of a tall building. Rotate the image until the vertical object is oriented vertically in the image.


North-up doesn’t quite feel right


Rotating 133° makes this feel much more natural and easier to understand


Squashed Pictures

Oblique pictures aren’t the only reason things might look a little weird or squished. Using the incorrect projection can also be a problem.  WGS84 is a very common projection in use, however, there are variations to consider. If things looks a little squashed, like the image on the left, consider changing to a more specific EPSG or looking for projection information in the metadata of your image or the metadata file associated with your imagery.


You can change the projection in the bottom right section of your QGIS window. (Here seen as EPSG:32636)



Incorrect EPSG

Correct EPSG



Panchromatic vs Multispectral


You’re probably just looking for a picture, but it’s important to know that satellites take pictures in different bands separately. This means that often you’ll get a panchromatic (black and white) layer separate from the multispectral (color) images. What’s especially interesting, and potentially useful, is that the panchromatic layer is typically captured at a higher resolution than the multispectral layer. What you normally see is a combined image, after a process known as pansharpening. This combines the detail of the panchromatic image with the nearest color information of the multispectral layers. Here’s an example of imagery collected from Airbus SPOT.



Panchromatic

Multispectral

Pansharpened



Since panchromatic is the highest resolution imagery, sometimes you may want to use only panchromatic imagery by itself when trying to identify the type of vehicle or other small details.


Creating pansharpened images is simple in QGIS. Simply search for the “Pansharpening” tool in the search, normally in the lower left corner of your window:



Then select the correct panchromatic and multispectral layers and press “Run”. Panchromatic usually has a “P” or “PAN” in the name, and multispectral usually has “M” OR “MS” in the name.



You’ll end up with a new layer named “output” with your new pansharpened image.




Funny Looking Bushes: Finding Camouflaged Equipment

Militaries use green/olive drab colors on their equipment to help camouflage it from visual observation. However, satellites have a few advantages in detection of equipment.


First, SAR imagery isn’t confused by paint jobs, and can even see through some materials such as light foliage, tarps, or tents to detect vehicles within. SAR can still be confused by reflective materials, but if you’re searching with high-resolution SAR from Capella Space or ICEEYE, you’ll find enough detail to determine if an object is a vehicle you’re interested in.


For optical imagery we have the advantage of the infrared (IR) spectrum. IR energy reacts differently on paint/vehicles than on natural materials. Some camouflage nets are better suited to create an IR signature more similar to natural vegetation, but most vehicles are more obvious in the IR bands.


Let’s take a look at an example of vehicles under different optical bands. How many vehicles can you see?


How now, about when using different IR bands?


Back to the original


There are lots of things that can be seen in the IR spectrum, and this is just one example.


Simple Annotations in QGIS

There are a lot of very advanced ways to use QGIS to create amazing maps and other geospatial products. But for the easiest way to get the basics in place, use the View > Decorations menu options. From here you can easily add basic annotations like a scale bar, a north arrow, a title, and a copyright notice. 


Exporting Images from QGIS

When you’re ready to share your work, you can use the File > Import/Export menu items to save a copy of your work in an easy-to-share format.


Some things to consider when exporting:

  • You can export GeoTIFF images for use in other tools.

  • Most licenses place limits on the exports you can make for publication.

    • Max resolution of products is typically limited to about 2048 pixels wide

    • Images must not be stretched beyond native resolution

    • Images must have conspicuous copyright notices in place

    • Images may not contain geospatial data (e.g. no JP2 or GeoTIFF exports)



Appendix: Getting raw data from SentinelHub

Many platforms simply give you a file or set of files to download and process. Sentinel Hub allows you to view and work with your imagery directly in the platform. Exporting the raw imagery is in a non-obvious location. You’ll need to do this if you want to process the raw data in a tool like QGIS.


  1. Visit https://apps.sentinel-hub.com/dashboard/#/tpdi (Login if needed)

You should see a list of recent orders

  1. Select the order you want to export.

  2. Click the download icon under “Actions” in the lower, right area in the Deliveries section.

  3. Here you can download individual files. More likely you’ll want to download all of them together as a single ZIP file.

  4. Click on the Archive tab at the top.

  5. You should now see the “Request Download” button. Click it.

  6. Wait 1-2 minutes, and click the refresh button. Your ZIP file will be available once processing is complete. Unzip this file and open it in QGIS or your favorite tool.