15
15
frame_processor_lock = threading .Lock ()
16
16
frames_lock = threading .Lock ()
17
17
completion_event = threading .Event ()
18
- all_paris = True
18
+ all_pairs = True
19
19
composite_frames = []
20
20
sensor_to_frames = {}
21
21
sensor_to_framesets = {}
@@ -41,7 +41,7 @@ def process(self, frame):
41
41
42
42
def create_sw_frame (video_frame , profile ):
43
43
new_video_frame = rs .software_video_frame ()
44
- new_video_frame .data = np . array ( np . hstack ( np . asarray ( video_frame .get_data (), dtype = np . uint8 )), dtype = np . uint8 )
44
+ new_video_frame .data = bytearray ( video_frame .get_data ())
45
45
new_video_frame .bpp = video_frame .get_bytes_per_pixel ()
46
46
new_video_frame .stride = video_frame .get_width () * video_frame .get_bytes_per_pixel ()
47
47
new_video_frame .timestamp = video_frame .get_timestamp ()
@@ -58,13 +58,13 @@ def validate_ppf_results(result_frame, reference_frame):
58
58
test .check_equal (result_profile .width (), reference_profile .width ())
59
59
test .check_equal (result_profile .height (), reference_profile .height ())
60
60
61
- v1 = np . asarray (result_frame .get_data ()). astype ( dtype = np . uint8 ). reshape ( - 1 )
62
- v2 = np . asarray (reference_frame .get_data ()). astype ( dtype = np . uint8 ). reshape ( - 1 )
61
+ v1 = bytearray (result_frame .get_data ())
62
+ v2 = bytearray (reference_frame .get_data ())
63
63
test .check_equal_lists (v1 ,v2 )
64
64
65
65
66
66
def process_frame (frame , frame_source ):
67
- sensor_name = rs .sensor_from_frame (frame ).get_info (rs .camera_info .name )
67
+ sensor_name = rs .sensor . from_frame (frame ).get_info (rs .camera_info .name )
68
68
with frame_processor_lock :
69
69
if sensor_name in sensor_to_frames :
70
70
sensor_to_frames [sensor_name ].append (frame )
@@ -75,9 +75,9 @@ def process_frame(frame, frame_source):
75
75
frameset = frame_source .allocate_composite_frame (sensor_to_frames [sensor_name ])
76
76
frameset .keep ()
77
77
sensor_to_framesets [sensor_name ] = frameset
78
- all_paris = True
78
+ all_pairs = True
79
79
else :
80
- all_paris = False
80
+ all_pairs = False
81
81
82
82
83
83
def check_condition (sensors ):
@@ -95,7 +95,7 @@ def callback_for_get_frames(frame, sensor_to_frame, sensors):
95
95
with frames_lock :
96
96
if len (sensor_to_frame ) < len (sensors ):
97
97
frame .keep ()
98
- sensor_name = rs .sensor_from_frame (frame ).get_info (rs .camera_info .name )
98
+ sensor_name = rs .sensor . from_frame (frame ).get_info (rs .camera_info .name )
99
99
sensor_to_frame [sensor_name ] = frame
100
100
101
101
@@ -138,7 +138,7 @@ def get_composite_frames(sensors):
138
138
139
139
while True :
140
140
with frame_processor_lock :
141
- if len (sensor_to_framesets ) >= len (sensors ) and all_paris is True :
141
+ if len (sensor_to_framesets ) >= len (sensors ) and all_pairs is True :
142
142
break
143
143
time .sleep (0.0001 )
144
144
@@ -178,24 +178,21 @@ def compare_processed_frames_vs_recorded_frames(record_block, file):
178
178
179
179
180
180
################################################################################################
181
- test .start ("Test align depth to color from recording" )
181
+ with test .closure ("Test align depth to color from recording" ):
182
+ record_block = AlignRecordBlock (rs .stream .color , rs .stream .depth )
183
+ compare_processed_frames_vs_recorded_frames (record_block , "[aligned_2c]_all_combinations_depth_color.bag" )
182
184
183
- record_block = AlignRecordBlock (rs .stream .color , rs .stream .depth )
184
- compare_processed_frames_vs_recorded_frames (record_block , "[aligned_2c]_all_combinations_depth_color.bag" )
185
-
186
- test .finish ()
187
185
################################################################################################
188
- test .start ("Test align color to depth from recording" )
186
+ with test .closure ("Test align color to depth from recording" ):
189
187
190
- composite_frames = []
191
- sensor_to_frames = {}
192
- sensor_to_framesets = {}
193
- sensor_to_frame = {}
194
- all_paris = True
188
+ composite_frames = []
189
+ sensor_to_frames = {}
190
+ sensor_to_framesets = {}
191
+ sensor_to_frame = {}
192
+ all_pairs = True
195
193
196
- record_block = AlignRecordBlock (rs .stream .depth , rs .stream .color )
197
- compare_processed_frames_vs_recorded_frames (record_block , "[aligned_2d]_all_combinations_depth_color.bag" )
194
+ record_block = AlignRecordBlock (rs .stream .depth , rs .stream .color )
195
+ compare_processed_frames_vs_recorded_frames (record_block , "[aligned_2d]_all_combinations_depth_color.bag" )
198
196
199
- test .finish ()
200
197
################################################################################################
201
198
test .print_results_and_exit ()
0 commit comments