From 6f72416a02f0999e8a55f44c2d6f863ba526dba0 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 14:02:17 -0300 Subject: [PATCH] Rectify meteor night passes --- rectify.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/rectify.py b/rectify.py index 1b95e82..c20ba43 100755 --- a/rectify.py +++ b/rectify.py @@ -73,11 +73,16 @@ def wthread(rectified_width, corr, endrow, startrow): # Linearly interpolate for i in range(delta): - interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) - interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) - interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) - - rectified_pixels[cur_col, row] = (interp_r, interp_g, interp_b) + # For night passes of Meteor the image is just gray level and + # start_px and end_px being an int instead of a tuple + if type(start_px) != int: + interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) + interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) + interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) + rectified_pixels[cur_col,row] = (interp_r, interp_g, interp_b) + else: + interp = int((start_px*(delta-i) + end_px*i) / delta) + rectified_pixels[cur_col,row] = interp cur_col += 1 start_px = end_px @@ -94,11 +99,16 @@ def wthread(rectified_width, corr, endrow, startrow): # Linearly interpolate for i in range(delta): - interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) - interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) - interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) - - rectified_pixels[cur_col, row] = (interp_r, interp_g, interp_b) + # For night passes of Meteor the image is just gray level and + # start_px and end_px being an int instead of a tuple + if type(start_px) != int: + interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) + interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) + interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) + rectified_pixels[cur_col,row] = (interp_r, interp_g, interp_b) + else: + interp = int((start_px*(delta-i) + end_px*i) / delta) + rectified_pixels[cur_col,row] = interp cur_col -= 1 start_px = end_px