Hexagon Geospatial
MENU

Spatial Recipes

ERDAS IMAGINE, the world’s leading geospatial data authoring system, supplies tools for all your Remote Sensing and Photogrammetry needs.
Showing results for 
Search instead for 
Do you mean 

 

Download model

 

Description:

 

 DigitalGlobe QuickBird image with cloud and shadows masked to NoData (shown in orange)
Fill_Cloud_Holes_New_Image.png

 

The model replaces a cloud covered area of a (newer) image using data from another (older) image of the same area (but with no clouds in the areas which need updating). A linear regression based model is established between the two images using the new Linear Regression operator and then the model fills in the cloud areas in the first image based on the linearly-adjusted data from the second image. If the linear regression were not used to "color match" the older image to the newer image the substitution of older pixels in the cloud locations would likely result in a clearly visible line where the substitution had occurred because of variations in image collection parameters between the two dates (one image might be markedly brighter overall than the other).

 

Simple DN substitution shows brightness differences Cloud holes filled using the model (with Blend option On)
Fill_Cloud_Holes_Simple_substitution.png Fill_Cloud_Holes_Matched_Blend.png

 

This same technique can be used in a variety of applications, such as to correlate an NDVI image to field-measured Leaf Area Index (LAI) samples in order to extrapolate the LAI across the entire NDVI extent.

 

Inputs and assumptions for the model:

 

  • A raster which has a cloud covered area

  • The cloud locations (and other corrupted locations, such as cloud shadows) are assumed to have already been masked from the image and replaced with NoData

  • A second raster to be used for filling the NoData locations in the first raster with valid data

  • Clouds and other erroneous pixel locations should also have been removed from the second image so that the linear regression can do its job properly

  • The two images should have the same number of bands. The model checks for this via the Require Condition operator and will stop execution if the number of bands is found to be unequal.

  • The bands should correspond to the same wavelengths - don't try to use a NRG image to patch holes in an RGB!

  • The images can have differing data ranges - for example, the Older Cloud-free Image could be 16-bit and the Newer Cloudy Image could be 8-bit. The Linear Regression will take care of mapping the data range to that of the Newer Cloudy Image

  • The model was designed primarily for unsigned 8 to 16 bit dynamic range data, but should work for other ranges too.

 

Blend Option

 

Even with the color balancing applied via the linear regression there may still be visible edges where the clouds have been replaced (especially if the cloud mask did not fully exclude hazy edges of the clouds which will therefore have "brighter" responses compared to the filled areas). So the model includes an option to Blend Edges. If set to True this option first creates a buffer two-pixels wide around the NoData hole locations. In this buffer zone the output pixel values are modified such that in the 1 pixel distant ring the DNs are a blend of 67% regression-matched old image values / 33% new image values, and in the 2-pixel distant ring the DNs are a blend of 33% regression-matched old image values / 67% new image values. In this manner there is a gradual transition from older image values to new image values which acts to blur the transition.

 

Model:

 

fill_cloud_holes_v16_5_1.gmdx
Fill_Cloud_Holes_Model.PNG
 
Raster Match Iterator sub-model
Fill_Cloud_Holes_Model_Iterator.PNG

 

Input parameters:

 

Old Image: Name of image to be used to fill cloud holes

New Image with Cloud Holes: Newer image with NoData holes where clouds (and other corrupted data, such as shadows) were present. These holes will be filled using DN values derived from the Old Image input

Blend Edges?: If turned on (true or 1) this option causes the edges of the NoData holes to be gradually blended with the "fill" data inorder to smooth the edge

Output Filename: Name of the output raster image with NoData holes filled.

 

 

Fill_Cloud_Holes_GUI.png

   

 

 

 
Comments
by Technical Evangelist
‎07-13-2018 07:29 AM - edited ‎07-13-2018 08:16 AM

I knew I shouldn't have made a last minute change to the model (v16_5_1) just before publishing it here. My idea of using 66,000 as the NoData replacement doesn't work as expected for u16 input images so the "blending" isn't working in that version. I'll fix the model today and update the link to a newer version model (probably v16_5_3), plus I'll update the text of the article to match.

 

Fixed as of 11:15am EST, 7/13/2018

Courses
Contributors