From 294bcda0d2d5083e78e5bce2897ec86749b384f3 Mon Sep 17 00:00:00 2001 From: "li.zhenye" <李> Date: Sat, 30 Jul 2022 15:07:16 +0800 Subject: [PATCH] 1024 pixels tested version --- config.py | 4 ++-- main.py | 4 +++- main_test.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 9d3a5ff..8965715 100644 --- a/config.py +++ b/config.py @@ -31,8 +31,8 @@ class Config: rgb_size_threshold = 4 # mask parameter - target_size = (256, 1024) # (Width, Height) of mask + target_size = (1024, 1024) # (Width, Height) of mask # save part - offset_vertical = -70 + offset_vertical = 0 diff --git a/main.py b/main.py index 23d7fec..8458778 100755 --- a/main.py +++ b/main.py @@ -60,6 +60,8 @@ def main(): img_data = np.frombuffer(data_total, dtype=np.float32).reshape((Config.nRows, Config.nBands, -1))\ .transpose(0, 2, 1) rgb_data = np.frombuffer(rgb_data_total, dtype=np.uint8).reshape((Config.nRgbRows, Config.nRgbCols, -1)) + + # OFFSET compensate if Config.offset_vertical < 0: # 纵向的补偿小于0,那就意味着光谱图要上移才能补上,那么我们应该补偿SPEC相机的全 0 图像 new_conserve_part, real_part = img_data[:abs(Config.offset_vertical) // 4, ...],\ @@ -80,7 +82,7 @@ def main(): mask_result = (mask_spec | mask_rgb).astype(np.uint8) # control the size of the output masks - masks = [cv2.resize(mask.astype(np.uint8), Config.target_size) for mask in [mask_spec, mask_rgb]] + masks = [cv2.resize(mask.astype(np.uint8), Config.target_size) for mask in [mask_result, ]] # 写出 output_fifos = [mask_fifo_path, ] for fifo, mask in zip(output_fifos, masks): diff --git a/main_test.py b/main_test.py index 6a03238..8e1c912 100644 --- a/main_test.py +++ b/main_test.py @@ -162,5 +162,5 @@ class TestMain: if __name__ == '__main__': testor = TestMain() - testor.pony_run(test_path=r'/Volumes/LENOVO_USB_HDD/zhouchao/0730saved_img/correct', - test_rgb=True, test_spectra=True, get_delta=True) + testor.pony_run(test_path=r'/home/lzy/2022.7.30/tobacco_v1_0/saved_img/', + test_rgb=True, test_spectra=True, get_delta=False)