File: amsu_tpw.lua

package info (click to toggle)
satdump 1.2.2%2Bgb79af48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,648 kB
  • sloc: cpp: 276,768; ansic: 164,598; lisp: 1,219; sh: 283; xml: 106; makefile: 7
file content (28 lines) | stat: -rw-r--r-- 849 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28


function init()
    return 1 -- Number of channels to output
end

function process()
    local d1 = 0.754
    local d2 = -2.265
    local adj = 0.003 

    for x = 0, rgb_output:width() - 1, 1 do
        for y = 0, rgb_output:height() - 1, 1 do
            local ch23_8 = get_calibrated_value(0, x, y, true)
            local ch31_4 = get_calibrated_value(1, x, y, true)
            local centerPixel = x - rgb_output:width() / 2
            local theta = (centerPixel / rgb_output:width() * 98) * math.pi / 180
            local d0 = 8.24 - 2.622*math.cos(theta) + 1.846 * (math.cos(theta))^2

            local result = math.cos(theta)*(d0+d1*math.log(285 - ch23_8)+c2*math.log(285-ch31_4))+c3
            local output = result / 300
            set_img_out(0, x, y, output)
        end

        set_progress(x, rgb_output:width())
    end
end