Skip to content

Commit 5655e1c

Browse files
committed
PR notes fixed
1 parent 4ea90ec commit 5655e1c

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

unit-tests/post-processing/test-post-processing-from-bag.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
frame_processor_lock = threading.Lock()
1616
frames_lock = threading.Lock()
1717
completion_event = threading.Event()
18-
all_paris = True
18+
all_pairs = True
1919
composite_frames = []
2020
sensor_to_frames = {}
2121
sensor_to_framesets = {}
@@ -41,7 +41,7 @@ def process(self, frame):
4141

4242
def 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

6666
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)
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

8383
def 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
################################################################################################
201198
test.print_results_and_exit()

wrappers/python/pyrs_sensor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ void init_sensor(py::module &m) {
5656
}, "Start passing frames into user provided callback.", "callback"_a,py::call_guard< py::gil_scoped_release >())
5757
.def("start", [](const rs2::sensor& self, rs2::syncer& syncer) {
5858
self.start(syncer);
59-
}, "Start passing frames into user provided syncer.", "syncer"_a)
59+
}, "Start passing frames into user provided syncer.", "syncer"_a, py::call_guard< py::gil_scoped_release >())
6060
.def("start", [](const rs2::sensor& self, rs2::frame_queue& queue) {
6161
self.start(queue);
62-
}, "start passing frames into specified frame_queue", "queue"_a)
62+
}, "start passing frames into specified frame_queue", "queue"_a, py::call_guard< py::gil_scoped_release >())
6363
.def("stop", &rs2::sensor::stop, "Stop streaming.", py::call_guard<py::gil_scoped_release>())
6464
.def("get_stream_profiles", &rs2::sensor::get_stream_profiles, "Retrieves the list of stream profiles supported by the sensor.")
6565
.def("get_active_streams", &rs2::sensor::get_active_streams, "Retrieves the list of stream profiles currently streaming on the sensor.")
@@ -91,9 +91,9 @@ void init_sensor(py::module &m) {
9191
ss << ": \"" << self.get_info( RS2_CAMERA_INFO_NAME ) << "\"";
9292
ss << ">";
9393
return ss.str();
94-
} );
95-
m.def("sensor_from_frame", [](rs2::frame f) {
96-
auto sptr = rs2::sensor_from_frame(f);
94+
} )
95+
.def_static("from_frame", [](rs2::frame frame) {
96+
auto sptr = rs2::sensor_from_frame(frame);
9797
return *sptr;
9898
}, "frame"_a);
9999

0 commit comments

Comments
 (0)