From 14878662c134b6d8238b79be7848a6d041d9d366 Mon Sep 17 00:00:00 2001 From: FEIJINTI <83849113+FEIJINTI@users.noreply.github.com> Date: Thu, 4 Aug 2022 19:16:03 +0800 Subject: [PATCH] =?UTF-8?q?[ext]=20=E6=B7=BB=E5=8A=A0=E8=89=B2=E5=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main_test.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main_test.py b/main_test.py index c8e895a..c682d57 100644 --- a/main_test.py +++ b/main_test.py @@ -59,11 +59,18 @@ class TestMain: with open(os.path.join(test_path, spec_file_name), 'rb') as f: data = f.read() spec_img = transmit.BeforeAfterMethods.spec_data_post_process(data) + if convert: + spec_img_show = np.asarray(np.clip(spec_img[..., [21, 3, 0]] * 255, a_min=0, a_max=255), + dtype=np.uint8) + cv2.imwrite(rgb_file_name + '.bmp', spec_img_show[..., ::-1]) + spec_mask = self.test_spec(spec_img, img_name=spec_file_name) if test_rgb: with open(os.path.join(test_path, rgb_file_name), 'rb') as f: data = f.read() rgb_img = transmit.BeforeAfterMethods.rgb_data_post_process(data) + if convert: + cv2.imwrite(os.path.join(test_path, rgb_file_name + '.bmp'), rgb_img[..., ::-1]) rgb_mask = self.test_rgb(rgb_img, img_name=rgb_file_name) if test_rgb and test_spectra: if get_delta: @@ -165,8 +172,8 @@ class TestMain: if __name__ == '__main__': import argparse + parser = argparse.ArgumentParser(description='Run image test or ') tester = TestMain() - tester.pony_run(test_path=r'/home/lzy/2022.7.30/tobacco_v1_0/saved_img/', - test_rgb=True, test_spectra=True, get_delta=False) - + tester.pony_run(test_path=r'E:\zhouchao\8.4\yangeng', + test_rgb=True, test_spectra=True, get_delta=False, convert=True)