1515frame_processor_lock = threading .Lock ()
1616frames_lock = threading .Lock ()
1717completion_event = threading .Event ()
18- all_paris = True
18+ all_pairs = True
1919composite_frames = []
2020sensor_to_frames = {}
2121sensor_to_framesets = {}
@@ -41,7 +41,7 @@ def process(self, frame):
4141
4242def create_sw_frame (video_frame , profile ):
4343 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 ())
4545 new_video_frame .bpp = video_frame .get_bytes_per_pixel ()
4646 new_video_frame .stride = video_frame .get_width () * video_frame .get_bytes_per_pixel ()
4747 new_video_frame .timestamp = video_frame .get_timestamp ()
@@ -58,13 +58,13 @@ def validate_ppf_results(result_frame, reference_frame):
5858 test .check_equal (result_profile .width (), reference_profile .width ())
5959 test .check_equal (result_profile .height (), reference_profile .height ())
6060
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 ())
6363 test .check_equal_lists (v1 ,v2 )
6464
6565
6666def 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 )
6868 with frame_processor_lock :
6969 if sensor_name in sensor_to_frames :
7070 sensor_to_frames [sensor_name ].append (frame )
@@ -75,9 +75,9 @@ def process_frame(frame, frame_source):
7575 frameset = frame_source .allocate_composite_frame (sensor_to_frames [sensor_name ])
7676 frameset .keep ()
7777 sensor_to_framesets [sensor_name ] = frameset
78- all_paris = True
78+ all_pairs = True
7979 else :
80- all_paris = False
80+ all_pairs = False
8181
8282
8383def check_condition (sensors ):
@@ -95,7 +95,7 @@ def callback_for_get_frames(frame, sensor_to_frame, sensors):
9595 with frames_lock :
9696 if len (sensor_to_frame ) < len (sensors ):
9797 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 )
9999 sensor_to_frame [sensor_name ] = frame
100100
101101
@@ -138,7 +138,7 @@ def get_composite_frames(sensors):
138138
139139 while True :
140140 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 :
142142 break
143143 time .sleep (0.0001 )
144144
@@ -178,24 +178,21 @@ def compare_processed_frames_vs_recorded_frames(record_block, file):
178178
179179
180180################################################################################################
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" )
182184
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 ()
187185################################################################################################
188- test .start ("Test align color to depth from recording" )
186+ with test .closure ("Test align color to depth from recording" ):
189187
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
195193
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" )
198196
199- test .finish ()
200197################################################################################################
201198test .print_results_and_exit ()
0 commit comments