1

I am performing postprocessing on Landsat GeoTIFF images and want to use the Majority Filter as mentioned in the book on Image Analysis, Classification and Change Detection in Remote Sensing and ArcGIS Pro documentation.

Is there a Majority filter implementation available which is open source?

Perhaps someone can suggest a filter in OpenCV which gives results similar to Majority Filtering.

3

The open-source geospatial analysis library WhiteboxTools has a majority filter that works for single-band GeoTIFF images. You can download the library's compiled binaries from here, the project code repository is here, and source code for the majority filter tool is here. Instructions for how to call functions using Python can be found in the user manual. Here is an example of a Python script calling the majority filter tool:

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()
wbt.work_dir = "/path/to/data/"
wbt.majority_filter("image.tif", "filtered.tif", filterx=15, filtery=15)

The following is an example of applying a 15 x 15 majority filter to a portion of a Landsat image, band 1:

Band1 unfiltered

Band1 filtered

I should also add the disclaimer that I am the developer of the WhiteboxTools library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.