Documentation about palettes
martinber opened this issue · 3 comments
Hello, I'm implementing false color in my project using the same palette method you are using. If possible, I would like to know how are you generating the N19-HRPT-Falsecolor.png palette (or to know from where did you get it).
Also, adding an acknowledgement to my program pointing here (Xerbo/aptdec) is ok?
The N19 false color palette was made from a single HRPT pass, its just a LUT of ch1/ch4 to ch1/ch2.
I will have a search for the quick and dirty python script I used to make it but its probably long gone.
I couldn't find the original so heres a version I threw together in 10 minutes:
import sys
from PIL import Image
import numpy as np
if len(sys.argv) != 5:
print("Usage:", sys.argv[0], "ch1.png ch2.png ch4.png out.png")
exit();
ch1 = Image.open(sys.argv[1])
ch2 = Image.open(sys.argv[2])
ch4 = Image.open(sys.argv[3])
ch1_px = ch1.load()
ch2_px = ch2.load()
ch4_px = ch4.load()
sum = np.zeros((256, 256, 3))
count = np.zeros((256, 256))
for y in range(ch1.size[1]):
for x in range(ch1.size[0]):
ch1x = int(ch1_px[x, y] / 256)
ch2x = int(ch2_px[x, y] / 256)
ch4x = int(ch4_px[x, y] / 256)
sum[ch1x, ch4x, 0] += ch2x
sum[ch1x, ch4x, 1] += ch2x
sum[ch1x, ch4x, 2] += ch1x
count[ch1x, ch4x] += 1
out = Image.new('RGB', (256, 256));
out_px = out.load()
for y in range(256):
for x in range(256):
if count[x, y] != 0:
r = int(sum[x, y, 0]/count[x, y])
g = int(sum[x, y, 1]/count[x, y])
b = int(sum[x, y, 2]/count[x, y])
out_px[x, y] = (r,g,b)
out.save(sys.argv[4])
If the images are from SatDump you will need to replace the xxx / 256
with xxx / 240
and if you are using LeanHRPT you will need to disable calibration (just delete calibration.ini)
It took me time to look at it. Thank you very much!
In the end I didn't use it because I never received HRPT and I don't have images. But I like the method, it's a good idea