Spatial Modeler Discussions

Gain, exchange, and share knowledge, or discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of Hexagon Geospatial products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Occasional Contributor
Posts: 16
Registered: ‎10-08-2020
Accepted Solution

Filter pixels by standard deviation

I'd like to build a spatial model to output pixels that fall outside some standard deviation based on all pixels in the raster. For example, return all pixels greater than 2 standard deviations from the mean, etc. I would like to apply this to an entire raster instead of a focal window.

 

I see the standard deviation tool in the spatial modeler toolbox, but I can't figure out from the docs how to use it. I've used the greater than/less than tools to filter pixel values, but the standard deviation tool doens't seem to work in the same way.

 

Any guidance or sample model would be helpful.

Highlighted
Technical Evangelist
Posts: 1,048
Registered: ‎10-01-2015

Re: Filter pixels by standard deviation

Hi @and_viceversa 

 

Conceptually very easy - just use the Statistics operator to get the Mean and SD values for each band and then use the LT and GT operators to select the pixels that fall outside the desired ranges. Similar to what you would normally do to threshold an NDVI, but using two separate thresholds.

 

But - are you wanting to do this for multispectral imagery? If so how do you want the differing ranges per band to be handled? Are you wanting to And or Or the per-pixel selection?

 

I.e. for any given pixel, the band 1 value might be outside the SD range for band 1, but for band 2 the values might be inside band 2's SD range. Do you want to keep that pixel or reject it? Are you literally going to want a "sparse" multispectral result where some bands have values at a pixel location and some bands don't?

 

Either way you can set it up, but you just need to specify which way you want to go. And be very specific about how you decide to handle NoData for your particular data.

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 1,048
Registered: ‎10-01-2015

Re: Filter pixels by standard deviation

This would be the basic (sparse) approach:

 

SD.PNG

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Occasional Contributor
Posts: 16
Registered: ‎10-08-2020

Re: Filter pixels by standard deviation

Once again thank you for the outstanding support. This sort of template to functionally demonstrate each operator is extremely helpful and can be extended to fit my use case.