-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathpointcloud_viewer.py
3403 lines (2421 loc) · 122 KB
/
pointcloud_viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
__author__ = "Martin Hahner"
__contact__ = "[email protected]"
__license__ = "CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)"
# GUI adapted from
# https://memotut.com/create-a-3d-model-viewer-with-pyqt5-and-pyqtgraph-b3916/ and
# https://matplotlib.org/3.1.1/gallery/user_interfaces/embedding_in_qt_sgskip.html
import multiprocessing as mp
if __name__ == '__main__':
mp.set_start_method("spawn")
import os
import sys
import copy
import gzip
import socket
import pandas
import logging
import argparse
import tempfile
import warnings
warnings.simplefilter(action='ignore', category=DeprecationWarning)
warnings.simplefilter(action='ignore', category=FutureWarning)
warnings.simplefilter(action='ignore', category=UserWarning)
import numpy as np
import pickle as pkl
import matplotlib as mpl
import matplotlib.cm as cm
import pyqtgraph.opengl as gl
from glob import glob
from pathlib import Path
from pprint import pprint
from plyfile import PlyData
from typing import List, Dict
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from pyqtgraph.Qt import QtGui
from lib.LISA.python.lisa import LISA
from lib.cadc_devkit.other.create_image_sets import DROR_LEVELS
from lib.OpenPCDet.pcdet.utils import calibration_kitti
from lib.LiDAR_fog_sim.fog_simulation import ParameterSet, simulate_fog
from lib.LiDAR_fog_sim.SeeingThroughFog.tools.DatasetViewer.lib.read import load_calib_data, read_label
from lib.LiDAR_fog_sim.SeeingThroughFog.tools.DatasetFoggification.beta_modification import BetaRadomization
from lib.LiDAR_fog_sim.SeeingThroughFog.tools.DatasetFoggification.lidar_foggification import haze_point_cloud
from tools.wet_ground.augmentation import ground_water_augmentation
from tools.snowfall.simulation import augment
from tools.snowfall.sampling import snowfall_rate_to_rainfall_rate, compute_occupancy
try:
import torch
CUDA_AVAILABLE = torch.cuda.is_available()
from pcdet.utils import common_utils
from pcdet.datasets import build_dataloader
from pcdet.config import cfg, cfg_from_yaml_file
from pcdet.models import build_network, load_data_to_gpu
except ImportError as e:
CUDA_AVAILABLE = False
if __name__ == '__main__':
print(f'{e} => Inference not available')
try:
from lib.cadc_devkit.other.dror import dynamic_radius_outlier_filter, get_cube_mask
live_DROR_available = True
except ImportError as e:
if __name__ == '__main__':
print(f'{e} => live DROR not available')
live_DROR_available = False
def get_cube_mask() -> None:
raise NotImplementedError
def dynamic_radius_outlier_filter(sensor: str, signal: str, variant: str, before: int, filename: str) -> np.ndarray:
path = f'{DROR}/alpha_0.45/all/{sensor}/{signal}/{variant}'
name = Path(filename).name.replace('.bin', '')
file = f'{path}/{name}.pkl'
with open(file, 'rb') as f:
snow_indices = pkl.load(f)
mask = np.ones(before, dtype=bool)
mask[snow_indices] = False
return mask
MIN_DIST = 3 # in m -> to hide "the ring" around the sensor
CAMERA_READY = True
SAVE_IMAGES = False
ROTATE = 0
BLACK = ( 0, 0, 0, 255)
WHITE = (255, 255, 255, 255)
# R, G, B, alpha
COLORS = [( 0, 255, 0, 255), # cars in green
(255, 0, 0, 255), # pedestrian in red
(255, 255, 0, 255)] # cyclists in yellow
if CAMERA_READY:
DET_COLORS = [BLACK, # cars
BLACK, # pedestrian
BLACK] # cyclists
GRAY = (0, 0, 0, 100)
else:
# R, G, B, alpha
DET_COLORS = [( 0, 255, 0, 100), # cars in green
(255, 0, 0, 100), # pedestrian in red
(255, 255, 0, 100)] # cyclists in yellow
GRAY = (255, 255, 255, 100)
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--datasets', type=str, help='path to where you store your datasets',
default=str(Path.home() / 'datasets'))
parser.add_argument('-e', '--experiments', type=str, help='path to where you store your OpenPCDet experiments',
default=str(Path(__file__).parent.absolute() / 'experiments'))
args = parser.parse_args()
DATASETS_ROOT = Path(args.datasets)
EXPERIMENTS_ROOT = Path(args.experiments)
DROR = Path(__file__).parent.absolute()
AUDI = DATASETS_ROOT / 'A2D2/camera_lidar_semantic_bboxes'
LYFT = DATASETS_ROOT / 'LyftLevel5/Perception/train_lidar'
ARGO = DATASETS_ROOT / 'Argoverse'
PANDA = DATASETS_ROOT / 'PandaSet'
DENSE = DATASETS_ROOT / 'DENSE/SeeingThroughFog/lidar_hdl64_strongest'
KITTI = DATASETS_ROOT / 'KITTI/3D/training/velodyne'
WAYMO = DATASETS_ROOT / 'WaymoOpenDataset/WOD/train/velodyne'
HONDA = DATASETS_ROOT / 'Honda_3D/scenarios'
APOLLO = DATASETS_ROOT / 'Apollo3D'
NUSCENES = DATASETS_ROOT / 'nuScenes/sweeps/LIDAR_TOP'
HOSTNAME = socket.gethostname()
if HOSTNAME == 'beauty' or HOSTNAME == 'beast':
DENSE = Path.home() / 'datasets_local' / 'DENSE/SeeingThroughFog/lidar_hdl64_strongest'
def get_calib(sensor: str = 'hdl64'):
calib_file = Path(__file__).parent.absolute() / 'lib' / 'OpenPCDet' / 'data' / 'dense' / f'calib_{sensor}.txt'
assert calib_file.exists(), f'{calib_file} not found'
return calibration_kitti.Calibration(calib_file)
def get_fov_flag(pts_rect, img_shape, calib):
pts_img, pts_rect_depth = calib.rect_to_img(pts_rect)
val_flag_1 = np.logical_and(pts_img[:, 0] >= 0, pts_img[:, 0] < img_shape[1])
val_flag_2 = np.logical_and(pts_img[:, 1] >= 0, pts_img[:, 1] < img_shape[0])
val_flag_merge = np.logical_and(val_flag_1, val_flag_2)
pts_valid_flag = np.logical_and(val_flag_merge, pts_rect_depth >= 0)
return pts_valid_flag
def close_all_windows(exit_code: int = 0) -> None:
sys.exit(exit_code)
class Namespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class QHLine(QFrame):
def __init__(self):
super(QHLine, self).__init__()
self.setFrameShape(QFrame.HLine)
self.setFrameShadow(QFrame.Sunken)
class QVLine(QFrame):
def __init__(self):
super(QVLine, self).__init__()
self.setFrameShape(QFrame.VLine)
self.setFrameShadow(QFrame.Sunken)
class ImageWindow(QMainWindow):
def __init__(self) -> None:
super(ImageWindow, self).__init__()
self.monitor = QDesktopWidget().screenGeometry(0)
self.setGeometry(self.monitor)
self.centerWidget = QWidget()
self.setCentralWidget(self.centerWidget)
self.layout = QGridLayout()
self.centerWidget.setLayout(self.layout)
self.image_label = QLabel()
self.layout.addWidget(self.image_label, 0, 0)
# noinspection PyUnresolvedReferences
class LidarWindow(QMainWindow):
def __init__(self) -> None:
super(LidarWindow, self).__init__()
self.show_img = False
self.show_temp = False
self.image_window = ImageWindow()
self.boxes = {}
self.label = None
self.model = None
self.config = None
self.logger = None
self.sampler = None
self.eval_set = None
self.eval_loader = None
self.predictions = None
self.prediction_boxes = []
self.result_dict = {}
self.show_predictions = False
self.prediction_threshold = 50
self.gain = True
self.noise_variant = 'v4'
self.noise = 10
self.min_fog_response = -1
self.max_fog_response = -1
self.num_fog_responses = -1
self.dror_alpha = 0.45 # HDL64 Spec Sheet: Angular Resolution (Horizontal/Azimuth): 0.08° – 0.35°
self.dror_beta = 3
self.dror_k_min = 3
self.dror_sr_min = 4 # in cm
self.dror_alpha_scale = 100
self.p = ParameterSet(gamma=0.000001,
gamma_min=0.0000001,
gamma_max=0.00001,
gamma_scale=10000000)
self.p.beta_0 = self.p.gamma / np.pi
self.row_height = 20
self.monitor = QDesktopWidget().screenGeometry(0)
self.setGeometry(self.monitor)
self.setAcceptDrops(True)
self.simulated_fog = False
self.simulated_fog_pc = None
self.simulated_fog_dense = False
self.color_dict = {0: 'x',
1: 'y',
2: 'z',
3: 'intensity',
4: 'distance',
5: 'angle',
6: 'channel'}
self.min_value = 0
self.max_value = 63
self.point_size = 3
self.line_width = 3
if CAMERA_READY:
self.color_feature = 3
else:
self.color_feature = 2
self.threshold = 50
self.num_features = 5
self.dataset = None
self.success = False
self.extension = 'bin'
self.d_type = np.float32
self.intensity_multiplier = 1
self.color_name = self.color_dict[self.color_feature]
self.min_height = -400 # in cm
self.max_distance = 80 # in m
self.lastDir = None
self.droppedFilename = None
self.current_pc = None
self.current_mesh = None
self.temporal_pcs = []
self.temporal_meshes = []
self.file_name = None
self.file_list = None
self.index = -1
self.centerWidget = QWidget()
self.setCentralWidget(self.centerWidget)
self.layout = QGridLayout()
self.centerWidget.setLayout(self.layout)
self.num_columns = 6
self.current_row = 0
self.viewer = gl.GLViewWidget()
if CAMERA_READY:
self.viewer.setBackgroundColor('w')
self.viewer.setWindowTitle('drag & drop point cloud viewer')
self.viewer.opts['center'] = QVector3D(15, 0, 0)
self.viewer.opts['distance'] = 30
self.viewer.opts['elevation'] = 5
self.viewer.opts['azimuth'] = 180
self.layout.addWidget(self.viewer, 0, 6, 30, 170)
self.show_dror_cube = False
try:
self.dror_cube = gl.GLBoxItem(QtGui.QVector3D(1, 1, 1), color=GRAY, line_width=self.line_width)
except TypeError:
self.dror_cube = gl.GLBoxItem(QtGui.QVector3D(1, 1, 1), color=GRAY)
self.dror_cube.setSize(10, 2, 2)
self.dror_cube.translate(3, -1, -1)
self.current_row += 0
self.num_info = QLabel("")
self.num_info.setAlignment(Qt.AlignCenter)
self.num_info.setMaximumSize(self.monitor.width(), self.row_height)
self.layout.addWidget(self.num_info, self.current_row, 0)
self.file_name_label = QLabel()
self.file_name_label.setAlignment(Qt.AlignCenter)
self.file_name_label.setMaximumSize(self.monitor.width(), 20)
self.layout.addWidget(self.file_name_label, self.current_row, 1)
self.inference_btn = QPushButton('run inference')
self.inference_btn.setEnabled(False)
self.inference_btn.clicked.connect(self.run_inference)
self.layout.addWidget(self.inference_btn, self.current_row, 3, 1, 2)
self.minus6 = QCheckBox("-6")
self.minus6.setEnabled(False)
self.minus6.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus6, self.current_row, 5)
self.current_row += 1
self.choose_dir_btn = QPushButton("choose custom directory")
self.choose_dir_btn.clicked.connect(self.show_directory_dialog)
self.layout.addWidget(self.choose_dir_btn, self.current_row, 1)
self.prev_btn = QPushButton("<-")
self.next_btn = QPushButton("->")
self.prev_btn.clicked.connect(self.decrement_index)
self.next_btn.clicked.connect(self.increment_index)
self.layout.addWidget(self.prev_btn, self.current_row, 0)
self.layout.addWidget(self.next_btn, self.current_row, 2)
self.load_kitti_btn = QPushButton("KITTI")
self.load_kitti_btn.clicked.connect(self.load_kitti)
self.layout.addWidget(self.load_kitti_btn, self.current_row, 3)
self.load_nuscenes_btn = QPushButton("nuScenes")
self.load_nuscenes_btn.clicked.connect(self.load_nuscenes)
self.layout.addWidget(self.load_nuscenes_btn, self.current_row, 4)
self.minus5 = QCheckBox("-5")
self.minus5.setEnabled(False)
self.minus5.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus5, self.current_row, 5)
self.current_row += 1
if self.show_predictions:
self.visualize_predictions_btn = QPushButton('hide predictions', self)
else:
self.visualize_predictions_btn = QPushButton('show predictions', self)
self.visualize_predictions_btn.setEnabled(False)
self.layout.addWidget(self.visualize_predictions_btn, self.current_row, 0)
self.visualize_predictions_btn.clicked.connect(self.toggle_predictions)
self.experiment_path_box = QLineEdit(self)
self.experiment_path_box.setText('snow+wet')
self.layout.addWidget(self.experiment_path_box, self.current_row, 1)
self.current_experiment = self.experiment_path_box.text()
self.load_experiment_path_btn = QPushButton('load results', self)
self.layout.addWidget(self.load_experiment_path_btn, self.current_row, 2)
self.load_experiment_path_btn.clicked.connect(self.load_results)
self.load_dense_btn = QPushButton("DENSE")
self.load_dense_btn.clicked.connect(self.load_dense)
self.layout.addWidget(self.load_dense_btn, self.current_row, 3)
self.load_lyft_btn = QPushButton("LyftL5")
self.load_lyft_btn.clicked.connect(self.load_lyft)
self.layout.addWidget(self.load_lyft_btn, self.current_row, 4)
self.minus4 = QCheckBox("-4")
self.minus4.setEnabled(False)
self.minus4.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus4, self.current_row, 5)
self.current_row += 1
self.prediction_threshold_title = QLabel("prediction confidence")
self.prediction_threshold_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.prediction_threshold_title, self.current_row, 0)
self.prediction_threshold_label = QLabel(str(self.prediction_threshold))
self.prediction_threshold_label.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.prediction_threshold_label, self.current_row, 2)
self.prediction_threshold_slider = QSlider(Qt.Horizontal)
self.prediction_threshold_slider.setMinimum(0)
self.prediction_threshold_slider.setMaximum(100)
self.prediction_threshold_slider.setValue(self.prediction_threshold)
self.prediction_threshold_slider.setTickPosition(QSlider.TicksBelow)
self.prediction_threshold_slider.setTickInterval(10)
self.prediction_threshold_slider.setEnabled(False)
self.layout.addWidget(self.prediction_threshold_slider, self.current_row, 1)
self.prediction_threshold_slider.valueChanged.connect(self.prediction_threshold_slider_change)
self.load_honda_btn = QPushButton("H3D")
self.load_honda_btn.clicked.connect(self.load_honda)
self.layout.addWidget(self.load_honda_btn, self.current_row, 3)
self.load_argo_btn = QPushButton("Argoverse")
self.load_argo_btn.clicked.connect(self.load_argo)
self.layout.addWidget(self.load_argo_btn, self.current_row, 4)
self.minus3 = QCheckBox("-3")
self.minus3.setEnabled(False)
self.minus3.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus3, self.current_row, 5)
self.current_row += 1
self.mor_label = QLabel(f'meteorological optical range (MOR) = {round(self.p.mor, 2)}m')
self.mor_label.setAlignment(Qt.AlignCenter)
self.mor_label.setMaximumSize(self.monitor.width(), self.row_height)
self.layout.addWidget(self.mor_label, self.current_row, 1)
self.load_audi_btn = QPushButton("A2D2")
self.load_audi_btn.clicked.connect(self.load_audi)
self.layout.addWidget(self.load_audi_btn, self.current_row, 3)
self.load_waymo_btn = QPushButton("Waymo")
self.load_waymo_btn.clicked.connect(self.load_waymo)
self.layout.addWidget(self.load_waymo_btn, self.current_row, 4)
self.minus2 = QCheckBox("-2")
self.minus2.setEnabled(False)
self.minus2.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus2, self.current_row, 5)
self.current_row += 1
self.alpha_title = QLabel('attenuation coefficient')
self.alpha_title.setAlignment(Qt.AlignRight)
self.layout.addWidget(self.alpha_title, self.current_row, 0)
self.alpha_slider = QSlider(Qt.Horizontal)
self.alpha_slider.setMinimum(int(self.p.alpha_min * self.p.alpha_scale))
self.alpha_slider.setMaximum(int(self.p.alpha_max * self.p.alpha_scale))
self.alpha_slider.setValue(int(self.p.alpha * self.p.alpha_scale))
self.layout.addWidget(self.alpha_slider, self.current_row, 1)
self.alpha_slider.valueChanged.connect(self.update_labels)
self.alpha_label = QLabel(f"\u03B1 = {self.p.alpha}")
self.alpha_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.alpha_label, self.current_row, 2)
self.load_panda_btn = QPushButton("PandaSet")
self.load_panda_btn.clicked.connect(self.load_panda)
self.layout.addWidget(self.load_panda_btn, self.current_row, 3)
self.load_apollo_btn = QPushButton("Apollo")
self.load_apollo_btn.clicked.connect(self.load_apollo)
self.layout.addWidget(self.load_apollo_btn, self.current_row, 4)
self.minus1 = QCheckBox("-1")
self.minus1.setEnabled(False)
self.minus1.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.minus1, self.current_row, 5)
self.current_row += 1
self.beta_title = QLabel('backscattering coefficient')
self.beta_title.setAlignment(Qt.AlignRight)
self.layout.addWidget(self.beta_title, self.current_row, 0)
self.beta_slider = QSlider(Qt.Horizontal)
self.beta_slider.setMinimum(int(self.p.beta_min * self.p.beta_scale))
self.beta_slider.setMaximum(int(self.p.beta_max * self.p.beta_scale))
self.beta_slider.setValue(int(self.p.beta * self.p.beta_scale))
self.layout.addWidget(self.beta_slider, self.current_row, 1)
self.beta_slider.valueChanged.connect(self.update_labels)
self.beta_label = QLabel(f"\u03B2 = {round(self.p.beta * self.p.mor, 3)} / MOR")
self.beta_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.beta_label, self.current_row, 2)
self.toggle_img_btn = QPushButton("show image")
self.toggle_img_btn.setEnabled(False)
self.toggle_img_btn.clicked.connect(self.toggle_image_visibility)
self.layout.addWidget(self.toggle_img_btn, self.current_row, 3)
self.toggle_temp_btn = QPushButton("show temporal")
self.toggle_temp_btn.setEnabled(False)
self.toggle_temp_btn.clicked.connect(self.toggle_temp_visibility)
self.layout.addWidget(self.toggle_temp_btn, self.current_row, 4)
self.zero = QCheckBox("0")
self.zero.setEnabled(False)
self.zero.setChecked(True)
self.zero.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.zero, self.current_row, 5)
self.current_row += 1
self.gamma_title = QLabel("reflextivity of the hard target")
self.gamma_title.setAlignment(Qt.AlignRight)
self.layout.addWidget(self.gamma_title, self.current_row, 0)
self.gamma_slider = QSlider(Qt.Horizontal)
self.gamma_slider.setMinimum(int(self.p.gamma_min * self.p.gamma_scale))
self.gamma_slider.setMaximum(int(self.p.gamma_max * self.p.gamma_scale))
self.gamma_slider.setValue(int(self.p.gamma * self.p.gamma_scale))
self.layout.addWidget(self.gamma_slider, self.current_row, 1)
self.gamma_slider.valueChanged.connect(self.update_labels)
self.gamma_label = QLabel(f"\u0393 = {self.p.gamma}")
self.gamma_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.gamma_label, self.current_row, 2)
self.show_fov_only = True
self.show_fov_only_btn = QPushButton('show full 360°' if self.show_fov_only else 'show camera FOV only')
self.show_fov_only_btn.setEnabled(False)
self.show_fov_only_btn.clicked.connect(self.toggle_fov)
self.layout.addWidget(self.show_fov_only_btn, self.current_row, 3, 1, 2)
self.plus1 = QCheckBox("+1")
self.plus1.setEnabled(False)
self.plus1.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.plus1, self.current_row, 5)
self.current_row += 1
self.plus2 = QCheckBox("+2")
self.plus2.setEnabled(False)
self.plus2.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.plus2, self.current_row, 5)
self.log_info = QLabel("")
self.log_info.setAlignment(Qt.AlignCenter)
self.log_info.setMaximumSize(self.monitor.width(), self.row_height)
self.layout.addWidget(self.log_info, self.current_row, 1)
self.dense_split_paths = []
self.cb_splits = QComboBox()
# self.cb_splits.setEditable(True)
# self.cb_splits.lineEdit().setReadOnly(True)
# self.cb_splits.lineEdit().setAlignment(Qt.AlignCenter)
self.cb_splits.addItems(self.populate_dense_splits())
self.cb_splits.currentIndexChanged.connect(self.split_selection_change)
self.cb_splits.setEnabled(False)
self.layout.addWidget(self.cb_splits, self.current_row, 3, 1, 2)
self.current_row += 1
self.color_title = QLabel("color code")
self.color_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.color_title, self.current_row, 0)
self.color_label = QLabel(self.color_name)
self.color_label.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.color_label, self.current_row, 2)
self.color_slider = QSlider(Qt.Horizontal)
self.color_slider.setMinimum(0)
self.color_slider.setMaximum(6)
self.color_slider.setValue(self.color_feature)
self.color_slider.setTickPosition(QSlider.TicksBelow)
self.color_slider.setTickInterval(1)
self.layout.addWidget(self.color_slider, self.current_row, 1)
self.color_slider.valueChanged.connect(self.color_slider_change)
self.sensor = 'hdl64'
self.cb_sensors = QComboBox()
self.cb_sensors.addItems(['hdl64', 'vlp32'])
self.cb_sensors.currentIndexChanged.connect(self.sensor_selection_change)
self.cb_sensors.setEnabled(False)
self.layout.addWidget(self.cb_sensors, self.current_row, 3)
self.signal = 'strongest'
self.cb_signals = QComboBox()
self.cb_signals.addItems(['strongest', 'last'])
self.cb_signals.currentIndexChanged.connect(self.signal_selection_change)
self.cb_signals.setEnabled(False)
self.layout.addWidget(self.cb_signals, self.current_row, 4)
self.plus3 = QCheckBox("+3")
self.plus3.setEnabled(False)
self.plus3.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.plus3, self.current_row, 5)
self.current_row += 1
self.min_height_title = QLabel("minimum height")
self.min_height_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.min_height_title, self.current_row, 0)
self.min_height_label = QLabel(f'{self.min_height} cm')
self.min_height_label.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.min_height_label, self.current_row, 2)
self.min_height_slider = QSlider(Qt.Horizontal)
self.min_height_slider.setMinimum(-400)
self.min_height_slider.setMaximum(0)
self.min_height_slider.setValue(self.min_height)
self.min_height_slider.setTickPosition(QSlider.TicksBelow)
self.min_height_slider.setTickInterval(10)
self.layout.addWidget(self.min_height_slider, self.current_row, 1)
self.min_height_slider.valueChanged.connect(self.min_height_slider_change)
if self.simulated_fog:
self.alpha_slider.setEnabled(True)
self.beta_slider.setEnabled(True)
self.gamma_slider.setEnabled(True)
self.toggle_simulated_fog_btn = QPushButton("remove our fog")
else:
self.alpha_slider.setEnabled(False)
self.beta_slider.setEnabled(False)
self.gamma_slider.setEnabled(False)
self.toggle_simulated_fog_btn = QPushButton("add our fog")
self.toggle_simulated_fog_btn.clicked.connect(self.toggle_simulated_fog)
self.layout.addWidget(self.toggle_simulated_fog_btn, self.current_row, 3)
self.toggle_simulated_fog_btn.setEnabled(False)
if self.simulated_fog_dense:
self.toggle_simulated_fog_dense_btn = QPushButton("remove STF fog")
else:
self.toggle_simulated_fog_dense_btn = QPushButton("add STF fog")
self.toggle_simulated_fog_dense_btn.clicked.connect(self.toggle_simulated_fog_dense)
self.layout.addWidget(self.toggle_simulated_fog_dense_btn, self.current_row, 4)
self.toggle_simulated_fog_dense_btn.setEnabled(False)
self.plus4 = QCheckBox("+4")
self.plus4.setEnabled(False)
self.plus4.stateChanged.connect(self.update_temporal_clouds)
self.layout.addWidget(self.plus4, self.current_row, 5)
self.current_row += 1
self.max_distance_title = QLabel("maximum distance")
self.max_distance_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.max_distance_title, self.current_row, 0)
self.max_distance_label = QLabel(f'{self.max_distance} m')
self.max_distance_label.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.max_distance_label, self.current_row, 2)
self.max_distance_slider = QSlider(Qt.Horizontal)
self.max_distance_slider.setMinimum(0)
self.max_distance_slider.setMaximum(200)
self.max_distance_slider.setValue(self.max_distance)
self.max_distance_slider.setTickPosition(QSlider.TicksBelow)
self.max_distance_slider.setTickInterval(10)
self.layout.addWidget(self.max_distance_slider, self.current_row, 1)
self.max_distance_slider.valueChanged.connect(self.max_distance_slider_change)
self.current_row += 1
self.layout.addWidget(QHLine(), self.current_row, 0, 1, self.num_columns)
self.current_row += 1
self.dror_intensity = 'DROR'
self.dror_headline = QLabel(self.dror_intensity)
self.dror_headline.setAlignment(Qt.AlignCenter)
self.dror_headline.setMaximumSize(self.monitor.width(), 20)
self.layout.addWidget(self.dror_headline, self.current_row, 1)
self.apply_dror = False
self.toggle_cube_btn = QPushButton('hide cube' if self.show_dror_cube else 'show_cube')
self.toggle_cube_btn.setEnabled(False)
self.toggle_cube_btn.clicked.connect(self.toggle_dror_cube)
self.layout.addWidget(self.toggle_cube_btn, self.current_row, 3)
self.toggle_dror_btn = QPushButton("apply DROR")
self.toggle_dror_btn.clicked.connect(self.toggle_dror)
self.layout.addWidget(self.toggle_dror_btn, self.current_row, 4)
self.toggle_dror_btn.setEnabled(False)
self.current_row += 1
self.dror_alpha_title = QLabel("horizontal angular resolution")
self.dror_alpha_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.dror_alpha_title, self.current_row, 0)
self.dror_alpha_label = QLabel(f"\u03B1 = {self.dror_alpha}")
self.dror_alpha_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.dror_alpha_label, self.current_row, 2)
self.dror_alpha_slider = QSlider(Qt.Horizontal)
self.dror_alpha_slider.setMinimum(0)
self.dror_alpha_slider.setMaximum(100)
self.dror_alpha_slider.setValue(int(self.dror_alpha * self.dror_alpha_scale))
self.dror_alpha_slider.setTickPosition(QSlider.TicksBelow)
self.dror_alpha_slider.setTickInterval(10)
self.dror_alpha_slider.setEnabled(False)
self.layout.addWidget(self.dror_alpha_slider, self.current_row, 1)
self.dror_alpha_slider.valueChanged.connect(self.dror_change)
self.snowfall_rate_title = QLabel('snowfall rate')
self.snowfall_rate_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.snowfall_rate_title, self.current_row, 3)
self.velocity_title = QLabel('velocity')
self.velocity_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.velocity_title, self.current_row, 4)
self.current_row += 1
self.dror_beta_title = QLabel("multiplication factor")
self.dror_beta_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.dror_beta_title, self.current_row, 0)
self.dror_beta_label = QLabel(f"\u03B2 = {self.dror_beta}")
self.dror_beta_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.dror_beta_label, self.current_row, 2)
self.dror_beta_slider = QSlider(Qt.Horizontal)
self.dror_beta_slider.setMinimum(0)
self.dror_beta_slider.setMaximum(10)
self.dror_beta_slider.setValue(int(self.dror_beta))
self.dror_beta_slider.setTickPosition(QSlider.TicksBelow)
self.dror_beta_slider.setTickInterval(1)
self.dror_beta_slider.setEnabled(False)
self.layout.addWidget(self.dror_beta_slider, self.current_row, 1)
self.dror_beta_slider.valueChanged.connect(self.dror_change)
self.cb_snowfall_rate = QComboBox()
self.cb_snowfall_rate.addItems(['0.5', '1', '1.5', '2', '2.5'])
self.cb_snowfall_rate.currentIndexChanged.connect(self.snowfall_change)
self.cb_snowfall_rate.setEnabled(False)
self.layout.addWidget(self.cb_snowfall_rate, self.current_row, 3)
self.cb_velocity = QComboBox()
self.cb_velocity.addItems(['0.2', '0.4', '0.6', '0.8', '1', '1.2', '1.4', '1.6', '1.8', '2'])
self.cb_velocity.currentIndexChanged.connect(self.snowfall_change)
self.cb_velocity.setEnabled(False)
self.layout.addWidget(self.cb_velocity, self.current_row, 4)
self.current_row += 1
self.dror_k_min_title = QLabel("min. number of neighbors")
self.dror_k_min_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.dror_k_min_title, self.current_row, 0)
self.dror_k_min_label = QLabel(f"k_min = {self.dror_k_min}")
self.dror_k_min_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.dror_k_min_label, self.current_row, 2)
self.dror_k_min_slider = QSlider(Qt.Horizontal)
self.dror_k_min_slider.setMinimum(0)
self.dror_k_min_slider.setMaximum(10)
self.dror_k_min_slider.setValue(self.dror_k_min)
self.dror_k_min_slider.setTickPosition(QSlider.TicksBelow)
self.dror_k_min_slider.setTickInterval(1)
self.dror_k_min_slider.setEnabled(False)
self.layout.addWidget(self.dror_k_min_slider, self.current_row, 1)
self.dror_k_min_slider.valueChanged.connect(self.dror_change)
self.rainfall_rate_title = QLabel('')
self.rainfall_rate_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.rainfall_rate_title, self.current_row, 3, 1, 2)
self.current_row += 1
self.dror_sr_min_title = QLabel('min. search radius')
self.dror_sr_min_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.dror_sr_min_title, self.current_row, 0)
self.dror_sr_min_label = QLabel(f'sr_min = {self.dror_sr_min}cm')
self.dror_sr_min_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.dror_sr_min_label, self.current_row, 2)
self.dror_sr_min_slider = QSlider(Qt.Horizontal)
self.dror_sr_min_slider.setMinimum(0)
self.dror_sr_min_slider.setMaximum(100)
self.dror_sr_min_slider.setValue(self.dror_sr_min)
self.dror_sr_min_slider.setTickPosition(QSlider.TicksBelow)
self.dror_sr_min_slider.setTickInterval(10)
self.dror_sr_min_slider.setEnabled(False)
self.layout.addWidget(self.dror_sr_min_slider, self.current_row, 1)
self.dror_sr_min_slider.valueChanged.connect(self.dror_change)
self.toggle_snow_btn = QPushButton("apply snow")
self.toggle_snow_btn.setEnabled(False)
self.toggle_snow_btn.clicked.connect(self.toggle_snow)
self.layout.addWidget(self.toggle_snow_btn, self.current_row, 4)
self.current_row += 1
self.layout.addWidget(QHLine(), self.current_row, 0, 1, self.num_columns)
self.current_row += 1
########
# SNOW #
########
self.lisa = None
self.tmp_value = None
self.fixed_seed = True
self.apply_wet = False
self.apply_snow = False
self.apply_lisa = False
self.mode = 'gunn'
self.rain_rate = 71 # (mm/hr)
self.wavelength = 905 # (nm)
self.r_min = 0.9 # (m)
self.r_min_scale = 10
self.r_max = 120 # (m)
self.beam_divergence = 0.003 # (rad)
self.beam_divergence_scale = 10000
self.min_diameter = 0.05 # (mm)
self.min_diameter_scale = 100
self.range_accuracy = 0.09 # (m)
self.range_accuracy_scale = 100
self.snowfall_rate = '0.5'
self.terminal_velocity = '0.2'
self.rain_rate_title = QLabel('rain rate')
self.rain_rate_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.rain_rate_title, self.current_row, 0)
self.rain_rate_label = QLabel(f'Rr = {self.rain_rate}mm/hr')
self.rain_rate_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.rain_rate_label, self.current_row, 2)
self.rain_rate_slider = QSlider(Qt.Horizontal)
self.rain_rate_slider.setMinimum(1)
self.rain_rate_slider.setMaximum(200)
self.rain_rate_slider.setValue(self.rain_rate)
self.rain_rate_slider.setTickPosition(QSlider.TicksBelow)
self.rain_rate_slider.setTickInterval(50)
self.rain_rate_slider.setEnabled(False)
self.layout.addWidget(self.rain_rate_slider, self.current_row, 1)
self.rain_rate_slider.valueChanged.connect(self.snowfall_change)
self.lisa_alpha_label = QLabel('')
self.lisa_alpha_label.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.lisa_alpha_label, self.current_row, 3, 1, 2)
self.current_row += 1
self.wavelength_title = QLabel('wavelength')
self.wavelength_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.wavelength_title, self.current_row, 0)
self.wavelength_label = QLabel(f'\u03BB = {self.wavelength}nm')
self.wavelength_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.wavelength_label, self.current_row, 2)
self.wavelength_slider = QSlider(Qt.Horizontal)
self.wavelength_slider.setMinimum(905)
self.wavelength_slider.setMaximum(1550)
self.wavelength_slider.setValue(self.wavelength)
self.wavelength_slider.setTickPosition(QSlider.TicksBelow)
self.wavelength_slider.setTickInterval(15)
self.wavelength_slider.setEnabled(False)
self.layout.addWidget(self.wavelength_slider, self.current_row, 1)
self.wavelength_slider.valueChanged.connect(self.snowfall_change)
self.cb_lisa = QComboBox()
self.cb_lisa.addItems(['gunn', 'sekhon', 'rain',
'chu_hogg_fog', 'strong_advection_fog', 'moderate_advection_fog',
'coast_haze', 'continental_haze', 'moderate_spray', 'strong_spray', 'goodin et al.'])
self.cb_lisa.currentIndexChanged.connect(self.snowfall_change)
self.cb_lisa.setEnabled(False)
self.layout.addWidget(self.cb_lisa, self.current_row, 3, 1, 2)
self.current_row += 1
self.r_min_title = QLabel('r_min')
self.r_min_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.r_min_title, self.current_row, 0)
self.r_min_label = QLabel(f'r_min = {self.r_min}m')
self.r_min_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.r_min_label, self.current_row, 2)
self.r_min_slider = QSlider(Qt.Horizontal)
self.r_min_slider.setMinimum(1 * self.r_min_scale)
self.r_min_slider.setMaximum(10 * self.r_min_scale)
self.r_min_slider.setValue(int(self.r_min * self.r_min_scale))
self.r_min_slider.setTickPosition(QSlider.TicksBelow)
self.r_min_slider.setTickInterval(5)
self.r_min_slider.setEnabled(False)
self.layout.addWidget(self.r_min_slider, self.current_row, 1)
self.r_min_slider.valueChanged.connect(self.snowfall_change)
self.toggle_seed_btn = QPushButton('seed fixed' if self.fixed_seed else 'seed not fixed')
self.toggle_seed_btn.setEnabled(False)
self.toggle_seed_btn.clicked.connect(self.toggle_seed)
self.layout.addWidget(self.toggle_seed_btn, self.current_row, 3)
self.toggle_lisa_btn = QPushButton("apply LISA")
self.toggle_lisa_btn.setEnabled(False)
self.toggle_lisa_btn.clicked.connect(self.toggle_lisa)
self.layout.addWidget(self.toggle_lisa_btn, self.current_row, 4)
self.current_row += 1
self.r_max_title = QLabel('r_max')
self.r_max_title.setAlignment(Qt.AlignCenter)
self.layout.addWidget(self.r_max_title, self.current_row, 0)
self.r_max_label = QLabel(f'r_max = {self.r_max}m')
self.r_max_label.setAlignment(Qt.AlignLeft)
self.layout.addWidget(self.r_max_label, self.current_row, 2)
self.r_max_slider = QSlider(Qt.Horizontal)
self.r_max_slider.setMinimum(80)
self.r_max_slider.setMaximum(200)
self.r_max_slider.setValue(self.r_max)
self.r_max_slider.setTickPosition(QSlider.TicksBelow)
self.r_max_slider.setTickInterval(10)
self.r_max_slider.setEnabled(False)
self.layout.addWidget(self.r_max_slider, self.current_row, 1)
self.r_max_slider.valueChanged.connect(self.snowfall_change)