mirror of
https://github.com/NanjingForestryUniversity/supermachine-tobacco.git
synced 2025-11-08 14:23:55 +00:00
1024 pixels tested version
This commit is contained in:
parent
54dd39daa8
commit
294bcda0d2
@ -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
|
||||
|
||||
|
||||
4
main.py
4
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):
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user