Merge pull request #494 from RAD750/documentation

typo
This commit is contained in:
Jacopo 2023-11-15 22:55:14 +01:00 committed by GitHub
commit 0cee6a4f78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 0 deletions

BIN
resources/lut/NDVI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -0,0 +1,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

View file

@ -0,0 +1,31 @@
-- NDVI
function init()
img_lut = image8.new()
img_lut:load_png(get_resource_path("lut/NDVI.png"))
return 3
end
function process()
for x = 0, rgb_output:width() - 1, 1 do
for y = 0, rgb_output:height() - 1, 1 do
local cch2 = get_calibrated_value(0, x, y, true)
local cch1 = get_calibrated_value(1, x, y, true)
local ndvi = (cch2-cch1)/(cch2+cch1)
local ndvi_lutval = ((ndvi-(-1))*256)/(1-(-1))+0
local lut_result[0] = img_lut:get(0 * img_lut:height() * img_lut:width() + ndvi_lutval) / 255.0
local lut_result[1] = img_lut:get(1 * img_lut:height() * img_lut:width() + ndvi_lutval) / 255.0
local lut_result[2] = img_lut:get(2 * img_lut:height() * img_lut:width() + ndvi_lutval) / 255.0
for c = 0, 2, 1 do
set_img_out(c, x, y, lut_result[c])
end
end
set_progress(x, rgb_output:width())
end
end