1024 pixels tested version

This commit is contained in:
li.zhenye 2022-07-30 15:07:16 +08:00
parent 54dd39daa8
commit 294bcda0d2
3 changed files with 7 additions and 5 deletions

View File

@ -31,8 +31,8 @@ class Config:
rgb_size_threshold = 4 rgb_size_threshold = 4
# mask parameter # mask parameter
target_size = (256, 1024) # (Width, Height) of mask target_size = (1024, 1024) # (Width, Height) of mask
# save part # save part
offset_vertical = -70 offset_vertical = 0

View File

@ -60,6 +60,8 @@ def main():
img_data = np.frombuffer(data_total, dtype=np.float32).reshape((Config.nRows, Config.nBands, -1))\ img_data = np.frombuffer(data_total, dtype=np.float32).reshape((Config.nRows, Config.nBands, -1))\
.transpose(0, 2, 1) .transpose(0, 2, 1)
rgb_data = np.frombuffer(rgb_data_total, dtype=np.uint8).reshape((Config.nRgbRows, Config.nRgbCols, -1)) rgb_data = np.frombuffer(rgb_data_total, dtype=np.uint8).reshape((Config.nRgbRows, Config.nRgbCols, -1))
# OFFSET compensate
if Config.offset_vertical < 0: if Config.offset_vertical < 0:
# 纵向的补偿小于0那就意味着光谱图要上移才能补上那么我们应该补偿SPEC相机的全 0 图像 # 纵向的补偿小于0那就意味着光谱图要上移才能补上那么我们应该补偿SPEC相机的全 0 图像
new_conserve_part, real_part = img_data[:abs(Config.offset_vertical) // 4, ...],\ 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) mask_result = (mask_spec | mask_rgb).astype(np.uint8)
# control the size of the output masks # 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, ] output_fifos = [mask_fifo_path, ]
for fifo, mask in zip(output_fifos, masks): for fifo, mask in zip(output_fifos, masks):

View File

@ -162,5 +162,5 @@ class TestMain:
if __name__ == '__main__': if __name__ == '__main__':
testor = TestMain() testor = TestMain()
testor.pony_run(test_path=r'/Volumes/LENOVO_USB_HDD/zhouchao/0730saved_img/correct', testor.pony_run(test_path=r'/home/lzy/2022.7.30/tobacco_v1_0/saved_img/',
test_rgb=True, test_spectra=True, get_delta=True) test_rgb=True, test_spectra=True, get_delta=False)