Could someone please suggest me what would be the best way to remove such huge number of outlier data from the image. The regular clipping between data range in numpy array would simply reduce the data shape and the reconstruction to image is not possible going on that approach. I tried clipping the data range to one standard deviation range, but all the data including outlier got clustered in the edge.

Also, it's desirable to have the mean and standard deviation preserved with original data array after removing the outlier but not absolutely necessary.

PS: Things to keep in mind:

  1. Remove the outlier in range greater around -5 in the given histogram profile, also preserving the bimodal distribution and array shape(for image reconstruction).
  2. Clipping value in range brings the data at edge distorting the original result, which is unwanted.
  3. I tried to create masked array in numpy, but that cannot be saved as original file in rasterio.

image histogram

satellite image data

Thank you for your inputs!


1 Answer 1


Just a comment: if you are removing the data that you highlighted in red the mean will necessarily change. The large number of zeros probably stems from creating the rotated image where the space around it was filled with zeros. Just fill the area with different values or use a RGBA representation and make it translucent. Cropping the image is another solution but then you loose parts of the image.

Out of curiosity: what is shown in the image? Are these blood vessels?

  • $\begingroup$ This is a satellite data from alos-2 (eorc.jaxa.jp/ALOS/en/dataset/alos_open_and_free_e.htm). Noted that removing the huge zeros will change the mean. And also, you are correct that the zeros data is coming from the area surrounding the angled image. It's a single band image, and trying to add a different value would also distort the image statistics. Cropping is not desirable for my purpose. $\endgroup$ Oct 5, 2023 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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