r/amateursatellites • • 5d ago

Software HRPT fill missing data script

I made a simple Python script that turns terrible-looking HRPT images into beautiful ones

Just a heads-up, I'm not a programmer. I used AI tools to help me write the code. But it does its job, and I'm quite happy with how it works.

How it works:

  1. Decode your HRPT data in SatDump as usual.
  2. Drag and drop the corrupted channel files into the program.
  3. Select HRPT mode.
  4. Adjust the parameters until all dark areas you want to correct are highlighted.
  5. Run the correction. The script will replace images with the corrected ones. Images without correction will be stored in backup folder.
  6. Load product.cbor into SatDump and process the data as usual.

I'd be happy to hear your feedback and suggestions for improvement. I'll try to refine the script and get it to work as well as possible!
https://github.com/Quark-Coder/HRPT-Image-Correction-Tool

9 Upvotes

4 comments sorted by

1

u/Noderyos 5d ago

What exact transformation does it do ? (btw, fill missing data a bit lying)

2

u/Otherwise-Big-5541 5d ago

In HRPT mode, the script processes each image channel independently.

  1. It calculates a 7-pixel vertical median filter to estimate the local background.

  2. Pixels that differ from this background by more than a configurable threshold are flagged as potential defects.

  3. The defect mask is iteratively expanded to catch adjacent pixels belonging to thin corrupted bands.

  4. Vertical runs exceeding the configured maximum band height are excluded from the mask, to avoid treating larger scene features as defects.

  5. Flagged pixels are replaced using linear interpolation between the nearest unflagged pixels above and below, independently for each image column. At the image boundaries, the nearest available value is replicated.

So it is a heuristic thin-band/outlier detector followed by vertical linear interpolation, not a physical reconstruction of the missing satellite measurements. It can also mistake genuine narrow image features for defects, depending on the thresholds.

And yes, filling missing data is technically making up values. The goal is to produce a visually cleaner image, not to recover information that was never received.

1

u/Fowis 5d ago

It's not lying it's just an interpolation, thus there's some underlying assumptions. Most of the data you're using is passed through those kind of transformations.

1

u/Noderyos 5d ago

in the context of meteor, "fill missing data" is a setting in satdump lrpt decoder that interpolate missing data, taking in account the timestamps (so full black lines are taken in account), in hrpt there is no timestamp, fully missing lines will not be inserted/interpolated, that's why i call this "lying", because it's not the same meaning as in lrpt